Learn Macros

It happens many times that we have to accomplish boring repetitive tasks in MS Excel, such as formatting cells in lots of tables, to make them look more professional, in order to print, let’s say, a report for a client. Those tasks, although easy to do, require a lot of time to complete. Repetitive tasks can become a children’s play and all it takes is a little bit of set up in the very beginning.

Then, all you have to do is press one key and look how the computer is doing the job for you. This can be accomplished by using macros.

How much time one can save with macros?

I can tell you from experience that I managed to to do a three-day job in less than 20 minutes, with only one smart macro. It is true, it took me about one week to make it work properly, as it required a little bit of programming as well (because I needed some dynamic actions, I had to edit the macro and to input those instructions by hand). It was worth doing that, as that job was a monthly report which I had to do for a client for two years.

Here are few macros that I personally used in my work.

I will keep sharing more macros with you over time. If you have been using VBA in your work, Please submit the code in the form below for other users.

  • VBA code to import the MS Access query data into MS Excel Sub importAccessdata(strDBPath As String, strTableName As String)    Dim cnn As ADODB.Connection    Dim rs As ADODB.Recordset    Dim sQRY As String    Dim strFilePath As String    strFilePath = strDBPath    Set cnn ...
    Posted Jun 2, 2016, 9:55 AM by Ayush Jain
  • Store excel range in an array variable If you want to store excel range in string array variable , you can use this user define function.   Public Function ReturnArraySel(xlRange As Range) As String()     Dim strArray() As String ...
    Posted Nov 10, 2011, 12:58 AM by Ayush Jain
  • Get Full Network Path of mapped drive To get the full network path of mapped drive in windows, you can use the below VBA function. The function returns the full path on input of drive name like ...
    Posted Jun 26, 2011, 1:39 AM by Ayush Jain
  • Calculate how long macro runs If you want to know the duration of macro execution , You can use the below macro :Sub TimeTaken()    Dim strTime1 As String, strTime2 As String    strTime1 = Format(Now(), "mm-dd ...
    Posted Jun 19, 2011, 9:12 AM by Ayush Jain
  • Column Number to Alphabetical reference The below function can be used to convert any Column Number into Alphabets. example :- If you pass 1 to the function, it will Return A. If you pass 26, It ...
    Posted Mar 26, 2011, 7:37 AM by Ayush Jain
Showing posts 1 - 5 of 10. View more »

Submit VBA Macros

Subpages (1): VBA Macros