Difference between Macro code and VBA code?

Hashiru

Active Member
Joined
May 29, 2011
Messages
286
What is the difference between Macro code and VBA code?
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
They're basically the same thing: VBA is the language you use to program macros and functions.

I'd guess technically the difference would be VBA code can contain both functions and macros where as a macro code is only the macro part of the code.
 
Last edited:
Upvote 0
A 'macro' is usually vb written for use in Excel or Word, and sometimes will have been created using a macro recorder, where your actions are interpreted and turned into code. After that, it's largely preference. Some prefer to distiguish along the lines of how it was created (i.e scripted, rather than recorded), some just think 'vba code' sounds more serious & professional than 'macro', myself included.

They're all macros in the sense that they duplicate a set of instructions a user might concievably perform using the main program interface, although you could argue that when the code is doing something you couldn't perform via the normal user interface, that's when it comes more than just a macro.

{rant}I have to admit to having a bit of a bee in my bonnet on this one, since in our organisation 'macros' are seen to be trivial, whereas code is something more substantial, yet I'd defy anyone who makes this distinction to actually explain it in terms that made any sense.{/rant}
 
Upvote 0
Hi
Thanks for you detailed account and the links to further digrest. I asked this question, because I used MrExcel Macros and VBA Video tutorials and one of the amazing means we are asked to use to see what goes on when you record the macro was to have the main interface and the VBE opened. When you try to learn VBA scripting these are the things I saw: Keywords, Objects, Methods and Properties. I think from this and what I know is that Macro is generally recorded and short written in VBA language and VBA is generally the scripting of VBA language and can be long and so can perform more tasks as it can use both Sub and Function procedures, use variables instead of being hard-corded which the macro recorder tend to do most of the time. VBA scripting is more flexible.:cool::LOL:
 
Upvote 0
Hi
Thanks for the additional link. I think this cut it for me. Because I started VBA Scripting but left it to do MOS first to get a detailed insight. From the MrExcel Videos, Excel Programming for VBA and you explanation I am satisfied.

Thanks once more.:)
 
Last edited:
Upvote 0
Can we use VBA code ( logical) with Macros?

The short answer is yes. Misca pretty much nailed it. VBA is the code language, Visual Basic for Applications that Microsoft created to use specifically with their applications. It can be used with Access, Power Point, Outlook, Word and Excel as their primary products. A macro is simply a procedure that does something more efficiently in one of the applications than could be done manually. The macro today is written with VBA, whereas at one time years ago it had its own set of DOS functions which were referred to as macro language. But you can write macros in any programming language, most of which can be compiled and stored as executable files. VBA on the other hand cannot be compiled into an .EXE file. VBA compiles on the fly and thus you will periodically get some glitches when running a procedure which has actions to perform that require more time than it takes to execuite the next action. A timing problem with VBA. But those are minimal.
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,194
Members
448,554
Latest member
Gleisner2

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