Simple way To Start learning Macros

guru santhanam (Chartered Accountant) (97 Points)

18 June 2008  

Dear Friends,


Better way to understand macros is to RECORD and then "Read" the VB Script generated by the Macro to understand it.


Click Tools > Macros > Record New Macro


It will ask for macro name....(give some macro name)

Remember to select "This workbook" option in that window.


Once you click OK, a Macro "Stop Recording Toolbar"  will appear......


Try to do some simple calculations in the blank excel sheet.....(keep it very simple so that you can remember later)


Click Stop recording in "Stop Recording Toolbar"


Press Alt+F11 and in Top Left Hand side Corner...you can find the workbook on which you created will be listed.  In that list, select your workbook and open Modules Submenu listed in the same place....


Open Module 1.....you can see the macro name which you specified and the recorded VB Script for the activities which you did in the worksheet....


Try to recollect what you did in the worksheet and try to understand how to excel has interpreted it and recorded the VB Script...


This is the beginning to learn Macro....


Sample simple scripttts for your understanding:-


Range("D22").Select                   (means YOU have clicked D22 Cell in the worksheet.)

Sheets("Sheet3").Select               ( means YOU have clicked worksheet with name Sheet3)

Range("B4:I15").Select                  (means YOU have selected the range B4 to I15 )


Remember by doing this you can just have a look at a drop of an OCEAN......


Have faith, Try to do more, Explore....you ll be the master.....


Hope this helps u all


Regards,

gurusanthanam


Thanks to :Nagaraju pogula CA


------

"The difference between genius and stupidity is that genius has its limits." - Albert Einstein


"When I can't handle events, I let them handle themselves. " - Henry Ford