This video complements our how to record a macro in Excel tutorial. The video transcription appears below the video.
This is a short demo to show how easy it is to create an Excel macro using the recorder feature. So in this file, this is kind of an example of a file I would get on a recurring basis. And one of the problems
that I had with it is I would have to delete the same columns each and every time I got the file that I never used.
So it made perfect sense for me to create a macro, because that way I could just hit my keystrokes and just have the macro record all the actions behind it.
So don’t worry, it’s dummy data, so it doesn’t reflect any real people or anything of that nature. So the first thing that you can do is actually right-click down on your Status bar and that’ll bring up where you can actually customize a Status bar.
And I like adding the Macro Recording icon. And so you’ll see, it’s not recording yet. What’s happened is it has just added an icon so that I can click it to turn it on and click it to turn it off. So right now it’s in Off mode, but what I’m going to do is start actually recording the macro.
And the first thing that I’m asked is actually to give the macro a name. Now there’s two little kind of caveats on this. Excel doesn’t allow you to start a macro name with a number.
So to give you an example, I couldn’t say this was the 2017 election macro. And the second thing I can’t do is I can’t put spaces between the words.
So when you name a macro, you need to if you’re going to use descriptive words, you really should either use underscores or perhaps even camel casing. So in this example, I’m just going to say, Delete_voter_columns. All right.
And then I can assign it a shortcut key, which I like to do. However, I actually prefer adding the Shift key in the combination. And the reason is, is because I, if I just go Control and some other key, too often I run into a conflict with another program. So what I’m just going to do is type Shift and then V. Oops, sorry. It was not in the right field.
So I’ll just hit Shift and V and it will add it in there. And I also, in this case, want to save the macro into my Personal Macro Workbook. And the reason is, is because I want to be able to invoke this macro when I get new files from the county with regards to the same kind of data election file information.
So I’m going to keep it in Personal Macro Workbook, and I’m not going to give it a description, but I could. This is particularly useful if you’re sharing macros with different users or if, you know, you don’t use them on a regular basis and you’re coming back after a long period of time. You go, “What was it that this macro did?” So I’m just going to click, OK.
And now if I hover over it, you’ll see that the macro is currently recording, and then I’m just going to click it when I’m done. So I’ll start by choosing my first column because I don’t need the Voter ID. And now I’m pressing down my Control key to select other columns. And I’ll let up on the Control key, and I am just going to right-click and say Delete. Okay.
So now you can see that I now have far fewer columns and I’m just going to click off and now the macro has stopped recording. So now to test this out, I’m going to go to a second sheet.
Okay. And I’m just going to type my keystrokes, which were Control+Shift+V. And you’ll notice that it did the same thing on the copy of that spreadsheet. So it’s working on any spreadsheet that I actually want to work on.