Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you find yourself repeating certain command sequences in Excel, sometimes the thought is, here I go again, same thing all over. Do I have to go through those same six steps, those same eight steps? Ultimately the answer is no. There is a feature in Excel called a Macro. A Macro is simply the ability to take a single step that encompasses many, many steps. Let's start with just a small idea. You're the manager of an HR group, and what you do occasionally is you review this data like what we're seeing here.
And when you flag a cell because you think it's incorrect or needs adjustment, what you do, and admittedly this might be overkill. You go to the Home tab; you provide a color background, let's say yellow here. You might make the font red; make it bold and going overboard a bit, maybe even going into Borders, Thick Box Border. It's just to illustrate the idea that we've taken four or five actions here and we like that look. And we like to use it elsewhere too. Now if it's nearby, we could copy the format, that might not take too long, but we might be a few hundred rows away at one time or another.
Wouldn't it be great if we could simply hit a keystroke shortcut, or how about a button up in the Quick Access toolbar at the top of the screen that would achieve that same objective. Well, we could create what's called a Macro to achieve that effect. Let's take some other just small examples at least at first. When someone leaves this organization, what you usually do is not delete the record, because you want to hold onto it for while but maybe you do like to indicate that someone has left simply by applying strikethrough. And you can get to strikethrough a number of ways, but invariably what it means is after selecting the data, you can go to the Font tab and click the dialog box launcher, or you might press Ctrl+1.
In either case, you'll end at Format Cells, probably on the Font tab and there's a choice called Strikethrough, you click OK, there it is. Now a bit later, you might discover there's actually keystroke shortcut for that, its Ctrl+5. Now we don't call that a Macro, but in a certain sense it is. It's a single action. And in this case, it applies strikethrough or removes it. In a certain sense we can also make the case for saying that nearly every button in the ribbon menu system is like a little macro.
If you didn't know how to make a cell bold, you might have to go, by way of the dialog box launcher or by Right-Clicking on the cell possibly. Going to Format Cells, Font tab if it's not already selected and there's Bold. Probably almost nobody does this, most people learn on day one of Excel, there's a button up there, B, that too is like a macro, we just don't call those macros but they represent the concept of a single action that the takes the place of many actions.
And let's think a little bit larger here, what if this list of some 700 rows or so is within a dynamic organization and there's a lot of growth here, a lot of change, people come and go. What if it's up to you, two or three times a week to provide updated lists for a number of people? And one of the things you might do is sort this by department and then, print three copies. And then maybe you sort it by employee name and print a few more copies. And another thing you do in that same sequence is apply a filter to show only the hourly people, and you print that list and send it off to the interested people.
And you might imagine a few other sequences like that. Maybe sorted in different way and printed, or maybe you apply subtotals and collapse that list and copy it and paste it; and you can imagine any number of different things that you might be doing with a list like this. Now you probably didn't really time how long that would have taken, but maybe it takes you ten or twelve minutes and you do that two or three times a week. If you remember the steps or if you've written them down, if it's pretty clear to you what those steps are, you could then activate or turn on what's called a macro recorder.
And in the process go through all the steps that you've gone through manually. And thereafter, since the macro will be saved, you can simply start the process by clicking a keystroke shortcut and maybe that ten or 15-minute process takes a half a minute. Printing might take a little bit of time but otherwise it's extremely fast. And the more you know about the macro concept, the more you're tuned into the idea that automating certain aspects of repetitious work is going to be helpful to you. Here's another example.
There's a PricingSheet in this workbook. It would be handy if we knew where the formulas are, and there are couple shortcuts for that already. If you click on a single cell anywhere in this worksheet, on the Home tab you could go to the Find & Select button on the right and choose Formulas, and all the formula cells are highlighted. Now if you always want to apply color when you do that will involve a few more steps, maybe you'll click this drop-arrow here and you got a particular color you like use there, fine.
That's only a few steps, but that too could be automated. Imagine in any worksheet at any time if you said, I'd like to know which cells have formulas. Hit a keystroke shortcut and suddenly we'd see these cells highlighted. Now admittedly, the steps here aren't that many and you got to go to the Home tab, you got to go to Find & Select, you've got to select Formulas, and then you got click here and so on. We're not really counting the steps, but it's interesting how we do find even four and five step sequences sometimes just a little annoying.
A keystroke shortcut would be great here. A companion to this would take substantially longer. Suppose you say, I'd like to highlight just the cells that have pure numbers, not the ones with formulas, but the one with numbers. Process here as you might guess starts in that same location, Find & Select and then, this time Go To Special, not quite so obvious. And here, we can choose Constants, but then we would want to uncheck the box for Text, Logical, Errors, and click OK.
And here too, maybe apply a different color. Now, in no way am I saying this is a shortcut that everybody needs. In other words you have to identify what repetitious actions that you use frequently are the ones that you found annoying or the ones that you'd really like to speed up. I think for some people, these would be really helpful. If you're a worksheet troubleshooting kind of person, if you find yourself often doing that sort of thing, these steps here if turned into macros could really save you a lot of time. So the idea of a macro will vary widely depending upon whose thinking about what those shortcuts are, what potential shortcuts are really needed.
There's so many different ways to use Excel, but the idea of setting up a process to record our actions, so that we can then get to them quickly in the future is called a macro and it's an incredibly powerful tool for Excel users.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 91091 Viewers
80 Video lessons · 138152 Viewers
59 Video lessons · 56964 Viewers
52 Video lessons · 70598 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.