Record Macro vs VBA

whoopee

New Member
Joined
May 13, 2005
Messages
1
Hi guys,

I am an accounting student, and for one of my subjects I have to write a report on the Record Macro and VBA methods of creating macros in excel.

I have no prior knowledge of macros and I was wondering if any of you would be so kind as to help me.

Basically, I need to know how the VBA language and the Record Macro facility in Excel can be used to create macros, and to identify the advantages and disadvantages of both methods.

Using a few things I've found on the internet, I am able to make a working example of a macro using both methods. However, being an inexperienced macro creator, I am only able to come up with a few advantages and disadvantages.

I was wondering if any of you guys, (whom are more experienced than I am :)) can suggest some advantages and disadvanatages of using either method. And also, which method do you personally find better to use, and why.

Thanks in advance. :-D
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
One disadvantage of recording macros is that every action is recorded.
 
Upvote 0
Norie said:
One disadvantage of recording macros is that every action is recorded.

For the most part, yes, but this is not always the case. There are some things that don't seem to generate code in the macro recorder. Off the top of my head I have no clue what they are, but run across one every so often.
 
Upvote 0
I was referring to things like scrolling really.
 
Upvote 0
I figured as much--I was just throwing out the fact that there are some things that may not generate code if tried :)
 
Upvote 0
The main advantage of the macro recorder is that you really don't have to know anything much about code to use it. Record the step you wish to automate, and there you have it.

The biggest disadvantage is that the recorder is verbose. This is what copying A1 to B1 looks like from the recorder:
Code:
Sub Macro1()
    Selection.Copy
    Range("B1").Select
    ActiveSheet.Paste
End Sub

This is what you need/want:
Code:
Sub Macro1()
Range("A1").Copy Range("B1")
End Sub

The recorded version is rarely efficient code.
 
Upvote 0
Hi,
Another thing that I had came across is that, a macro recorded in one version may not really run on earlier versions. For ex. A macro to find all occurances of a word in a WORKBOOK can be recorded in Excel 2002, but the same cannot be run on Excel 2000 as such (without tweaking). But such a thing can be done with VB knowledge.
All keystrokes cannot be recorded by recording a macro. One ex. get the NEW tab activated in the DATA FORM . But the same can be done via VBA method.
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,321
Members
453,032
Latest member
Pauh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top