Excel Macro recording

what are the Important Things to be taken care before recording an Excel Macro?

  1. Jolt down the steps of how you are doing the activitiy manually, Reherse the activity, Once you start recording you should be able to do the steps correctly.
  2. While Recording, Let the focus be only on recording in Excel, Let us not move outside excel application or open some other excel file or do some actions which is not part of the scope of automation.
  3. Please keep your cursor outside the Target cell. Eg–> if the first step of the macro is It should go to cell A2, Let us ensure our cursor is outside of Cell A2 before we start recording and let the 1st step is where you use mouse to go and select Cell A2.
  4. You can have the Visual basic editor also seen so that when recording you can also see the VBA codes generated by your actions in Excel. This will help you understand what codes does what action.


Tips for Sucessful Recording of Excel Macro

While Recording, Please know when to use keyboard and when to use mouse as different codes are generated for the same action performed in mouse and keyboard.

While Recording, know when to record under relative reference ,Recording macro Relative ref wherever necessary and its advantages.

While Recording, Different Codes Using Mouse/Arrow Keys and Using Keyboard Shortcuts.
Deleting of Unnecessary codes after Recording.

  1. Delete unwanted codes happening thru scoll, minimizing windows, opening other workbooks etc. delete incidental actions and mistakes.
  2. Delete unwanted selection codes eg–> Range(“G2”).select coming two times one below the other.
  3. Remove extra codes that come with “with” codes in excel, eg–> if you change the alignment to left, all other unchanged parameters in the dialog box comes as codes.

Always try to create a macro which should give a finished product to the user, Eg–> Macro may create a column of data and leave it there, This means after the macro user has to do a column autofit to the output arrived.

This entry was posted in Excel Tips. Bookmark the permalink.