Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Before you begin to create a macro, you want to make sure that you know exactly the steps that you want to take before you begin to record, because once you start recording, it will track every single movement, every single click, every single selection as you go through your list. So you don't want any extraneous information or any extraneous commands in there. And so you really want to do a test run, and that's what I'd done before we've come here. So, let's begin. What I want to do is I want to have a quick way of adding a header to each of the different sheets that I'm going to be working with, and I want to be able to do that online. I don't want it as a header that I only see when I'm printing out, I want it visual on my worksheets when I'm working with them.
So, to do this quickly, I make sure that I have my Developer tab visible, and I click on it. And I'm coming over to my Record Macro area. So each set of the commands that I perform are going to be saved in the Macro, so that I can come back and play them again. I start this off by clicking on Record Macro, and the first thing I have to do is I have to name it. So, it's going to default to be named Macro1, but I may want to call it Insert title. I then identify what shortcut key am I going to use in order to activate this macro. A short cut key is some Ctrl+letter on my keyboard that it will automatically initiate this to happen.
I'm going to go down to my control, and then I'm going to type in my small letter a. Where do I want to store this macro? Well, I can store it as a Personal Macro Workbook, so it's only available to me when I'm working in my environment and my workbooks, I want to store it in a brand new workbook, or I want to store it in this workbook. And it's only visible in this particular workbook, and that's what I want to do. I can also write a description of what this particular macro's going to do and what it's anticipated end result will be. In case I do share it so that others know what we're working with.
So I've set up the original pieces for my Macro, and then I click OK. It tells me that the name that I've entered is not valid. Okay, so it can't have any spaces in my macro name up here. So included in Excel, is the ability to have it double check your information for you. So, I'm going to back up here to my Macro name, remove the space, and now I'm good to go. SO, it's now starting to do my recording because you'll see up here, it now has changed from Start Recording to Stop Recording.
So it's tracking what I'm doing. So, the first thing I want to do is I want to go up to row number 1, and I want to right-click and I want to Insert, which puts in one new row. Hit F4, which repeats that set of commands, and sets in another new row. SO I've got two new rows that I'm working with. I then select cell A1 and I type in EatCake Inventory. I enter that by clicking the checkbox, I then want to take that particular set of title, and I want to make sure it is centered across my tables. So I select the first two rows of my table, I then go back to my Home tab, and I select the Align & Center option. So that's the second under the Alignment group, that's the Merge & Center button, which is the second one towards the right of that grouping.
It puts it at the bottom of my page, so I want to align it so it's aligned in the middle of the cells. And then I also want to get a little bit fancy, and I want to change the font color to my theme color, and I'm going to make it green. So there we go. That's all of the commands that I wanted to perform. I go back to my Developer tab, and I turn off my Recording by selecting Stop Recording. Now, I want to see if this is going to work. Did it actually do what I want it to do? So, I go remove that information by just deleting my cells, go back up to cell A1 and use Ctrl+A.
Hitting those two keys automatically puts in the information that I just did. This is also available on another sheet, so if I click over to Sheet2, use Ctrl+A, there's my macro in place. That's how easy it is to do. Again, as a reminder, make sure you know what you're doing before you start, so that your macro is smooth as silk.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 90566 Viewers
80 Video lessons · 137937 Viewers
59 Video lessons · 56673 Viewers
52 Video lessons · 70303 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.