• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro recording and VB coding differences

mhghg

Member
Hello All,
I am just a basic learner so I wonder if we can use macro recording to create the script then why do we need vb for? When should wed use the vb rather than recorder?
Thanks
Macy
 
Hi ,

There are quite a few differences.

1. The macro recorder merely records your actions when you are manipulating the cursor and clicking on the menu options and otherwise interacting with the worksheet.

Since the user may not be the most expert user around , it is possible your actions will not necessarily be the most efficient way to achieve what you want.

Since the macro recorder is faithfully recording your actions , it follows that the code generated using the macro recorder may not be the most efficient code possible to achieve the desired results.

A simple example is that using the macro recorder you will get a lot of worksheet and cell selects , which can be time consuming. Writing the code yourself , you can do away with these time consuming selects.

2. There are several programming constructs such as loops , if statements , functions , which do not have an equivalent in user actions.

The significance of this is that certain outcomes cannot be achieved solely by using cursor manipulation and menu options ; naturally then the macro recorder cannot help in coding such outcomes. VBA will be required in such cases.

There may be other differences , but these two alone are major enough that you should take the time and trouble to learn VBA.

The macro recorder can take you only so far and no further.

Narayan
 
Back
Top