Focus video player for keyboard shortcuts
Auto
- 720p
- 540p
- 360p
1.00x
cc
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
A brief discussion about the differences between macros and VBA, and how this course covers both.
Exercise files
There are no related exercise files for this lesson.
Quick reference
Macros vs VBA - What's the Difference?
What is the difference between Macros and VBA?
When to use
Terms clarification for users new to programming in Excel.
Term Definitions
Macros
- A command launched from a single entry point
- Allows replaying a set of actions typically recorded via the user interface
VBA
- The programming language used to write macros
- Programming in this language allows us to do things that can’t be recorded
Why VBA is important
- Easiest way to learn to program in any language
- Allows you to learn syntax by watching live as you record
- Allows you to automate other applications
- 00:05 Before we dive into this course, what I wanna
- 00:08 cover first is just a little background on the difference between macros and VBA.
- 00:13 We tend to toss those terms out interchangeably, but
- 00:16 they're not exactly the same thing, and I wanna cover off why that is.
- 00:20 The first thing we wanna talk about is macros.
- 00:22 Now macros have existed for a long long time in lots of different applications.
- 00:27 They're not something that's specific to Excel.
- 00:29 Access has them,
- 00:29 and I worked with macros in a program called Act Pack Six which ran on DOS.
- 00:34 Basically what a macro is, is it's a pre-recorded
- 00:37 set of actions that we can use over and over again.
- 00:41 Typically what they do is, we'll go in and we'll record something to happen, and
- 00:45 then we'll be able to replay that from a specific single entry point.
- 00:49 By hitting that entry point, it allows us to replay those pre-recorded actions.
- 00:53 And the nice thing about it is that, typically,
- 00:55 it's actually something that we would record from the user interface, okay?
- 00:58 So, basically, a macro is just something that allows us to replay actions that
- 01:02 we've done at least once in the past.
- 01:05 When I think back to really old programs that I used to use, we actually had to
- 01:08 program these things a little bit through some scripting cells and whatnot.
- 01:12 But we could do something like, move through this cell,
- 01:15 arrow down a couple of times, hit enter, maybe pause for user input,
- 01:19 and then resume and stuff like that.
- 01:21 So, basically, steps that we've scripted to happen in a certain way.
- 01:27 VBA is a little bit different then that.
- 01:29 VBA is actually an entire programming language for scripting.
- 01:33 This is the language in Excel that we actually use to create our macros, but
- 01:38 the big difference here is it is a full language that we can work with.
- 01:42 And we can do things that you cannot record through the user interface as we're
- 01:47 working with it.
- 01:48 So this is a big, big difference here.
- 01:50 Macros are a pre-recorded set of actions.
- 01:52 VBA is an entire language that allows us to do all kinds of different things.
- 01:57 So why is VBA so important to us?
- 02:00 Well, the number one reason is that it's an easy language to get started with.
- 02:05 This is huge.
- 02:06 It's the lowest barrier to entry to learn programming on the planet, bar none.
- 02:11 Excel actually, if you have two monitors, will allow you to put the Visual Basic
- 02:15 editor on one monitor and your Excel on the other.
- 02:17 And as you start recording your macros,
- 02:19 you can actually watch it write the code for you as we go.
- 02:22 Now I'm not gonna do that in this particular course,
- 02:24 only because I don't have enough screen space to work with.
- 02:27 But if you've got two monitors at home, I highly suggest you try this.
- 02:30 Throw VBA on one monitor, throw Excel on the other, try recording a macro, and
- 02:33 watch as it writes line-by-line the stuff that you do.
- 02:36 It's very, very cool.
- 02:37 This is huge,
- 02:38 because it allows you to learn the syntax of the programming language as you go.
- 02:42 As you interact with Excel,
- 02:43 you'll see what's happening in the programming language.
- 02:45 The other really nice thing about VBA is that it actually teaches you
- 02:50 language concepts that are applicable to other languages' structure and
- 02:54 syntax, and how to actually work with something.
- 02:57 Now other programing languages have their own syntax and
- 02:59 their own way to work with things, that's always true.
- 03:03 But the beauty is that the concepts that you learn here are the same.
- 03:08 The first language I ever learned in programming was something called Basic,
- 03:11 back when I was in high school.
- 03:13 Way, way, way back when.
- 03:14 The second language I learned, and one we're actually really started to learn,
- 03:17 was actually VBA.
- 03:19 Today, I program in seven different languages, including C# and VB.NET and
- 03:23 a few others.
- 03:24 All of that language and all that knowledge that I got came from
- 03:27 working with Excel and learning to program through this particular user interface.
- 03:30 Will you get there tomorrow?
- 03:32 Absolutely not!
- 03:33 But will you actually be able to actually take that knowledge and
- 03:35 port it somewhere else?
- 03:36 If you want to, you absolutely will, and that's huge.
- 03:39 The other thing that I want you to be aware of with VBA is that it's much
- 03:43 bigger than just Excel.
- 03:45 VBA actually exists in every Office application.
- 03:49 This is really important.
- 03:50 Now, they all have their own object models,
- 03:51 and we'll talk more about object models a little bit later on in this course.
- 03:55 But the key part is that it's one common language frame
- 03:58 that's used throughout the entire Office suite.
- 04:02 This language has also been licensed by other companies and
- 04:04 is actually in use in some of their things.
- 04:06 AutoCAD has VBA in it, and
- 04:08 Corel had a few of their products that actually ported in some VBA as well.
- 04:13 So there's other programs that can actually make use of the same coding
- 04:15 structure, which is kind of nice.
- 04:17 Because once you start learning this, you can port it to other places.
- 04:20 But even bigger than that, as long as there's a library available to connect to
- 04:24 in Windows, even though this is outside the scope of this particular course.
- 04:29 If you learn VBA well,
- 04:30 you can actually control other Windows applications as well.
- 04:34 You can control things like Internet Explorer,
- 04:36 actually interact with the documents that you see on a web page and whatnot.
- 04:39 You can go and you control things like Access, that's an Office program.
- 04:42 But you can also start writing into other things where you're actually changing
- 04:45 the behavior of Windows as well, which is actually really kind of a cool thing.
- 04:49 So this is why learning VBA is so important.
- 04:52 Number one, it's easy as compared to any other programming language.
- 04:55 Number two, it's super powerful and it can allow you to do an awful lot of things.
- 04:59 I'm very excited to be bringing you this course, and
- 05:01 I hope that you enjoy it as we go through this.
Lesson notes are only available for subscribers.