Hey guys, welcome back. So in this video we're going to speak about the difference between recording macros and writing VBA code. So when you run a recorded macro, Excel just repeats the steps you recorded exactly as you've recorded them. So you record some steps, and Excel will just repeat them exactly as they have been recorded. However, when you write VBA code, you get much more power, and it enables more functionality on your code. So you can make decisions and repeat actions and much more.
So recording macros has limited functionality. And writing code opens a world of possibilities. And this is what we're going to learn on this course we're going to learn mainly how to write VBA code. So let's have an example here. Let's say we have this table here. Having some salesperson And their commissions.
So you can see here we've got some salespersons and the commission of each salesperson. So I could record a macro to bold the names of the salespersons. Okay, so as you can see here, I could record a macro to just build the names of all sales persons and you can see here the names have been bolded. However, in order to have a macro bold the name of a salesperson only if their commission is greater than $10,000. This cannot be done by recording. So it's absolutely impossible to record a macro that can make a decision to build the name based on the commission if it's more than $10,000.
However, this can be easily achieved when I write VBA code or when I write my macros. So this very simple case can show you that writing VBA code is much more powerful than recording macros. So someone could ask, why would we have the option then to record macros? So why did Microsoft include the option? If it's just better to write VBA code? Well, there are a couple of reasons for that.
The first one is that someone might not be able to write VBA code, he didn't have the skill to do so. And he might be wanting to do a task that is fairly simple. So he can just record that macro and just play it whenever he wants to achieve that task. And the second thing is that sometimes you may want to write a macro to do something. However, you do not know the method or property for that thing that you You want to do so you don't know the property to change or the method that would enable you to do that. And we will speak about methods and properties later on in the course.
But you basically don't know what code to write. So you could record that action in order to know what piece of code to write and then take it from there and start writing your macro. And this is a very common way to learn about something that you do not know how to do in Excel VBA. So you just record it, know the method or property that you need to use and just take it from there, start writing your code. Okay, so this was a quick overview about the difference between recording macros and writing VBA code. Thank you very much guys for watching this video and I'll see you on the next one.