I’ve gone and got my file and I’ve copied the macro code to the clipboard and I’m going to paste it in. In fact I’m going to do a little bit of the wrong thing so I can show you the result. So I have it in a file so I’m just going to copy and paste it. And it also places me right in the middle of this code area which is exactly where I put my macro code. And what that does is it automatically opens the Visual Basic Editor for me so I don’t have to do all the work. Macro name personal.xlsb workbook, click Create. But I want to create this in my personal.xlsb workbook so I want to make sure that I select that first. I’m just going to type removerows.Īnd now because I don’t have that macro Excel is offering me the option of creating it. You can’t use spaces but you can use underscores. Now macro names have to be one whole word. So I’m going to type the word removerows. And the macro I want to add is called remove rows. And this is a file that Excel takes care of opening every time you come and open Excel so these macros are always going to be available. It’s personal.xlsb whatever it is for your particular version of Excel. So I’m going to click Macros now and you can see here is the macro that we just created in this workbook personal.xls. All I want is this special file that is called personal.xls. I don’t actually want the macro and I don’t actually want the contents of that cell. That’s all it does and click Stop Recording. And I’m just going to type a couple of letters in there, press Enter. Whenever Excel is opened it opens this file and everything is fine and dandy so I’m just going to click Ok. And once it’s created then in future we’ll be able to store macros in it and these macros will always be available to every single worksheet. If you don’t have it Microsoft Excel creates it for you so that’s why we’re going to the trouble of recording just anything so that we can get this personal macro workbook created. And you’re going to store this macro in what is called the personal macro workbook. The simplest way to resolve that situation is to first before you do anything else go and click Record Macro. And chances are if you’ve never created a macro before you don’t have the very file that you need. Now before you can actually create a macro inside the place where it’s supposed to be you have to actually have this one file created. This might be one that you’ve been sent or it might be one you find on the web or whatever. In fact I’m just going to copy and paste it because I just want to show you the basics of creating a macro.
So the first thing we need to do is to make sure that the Developer tab is visible on the Ribbon and then we’re going to actually create this macro. So I have a worksheet here and I have some rows in which there is nothing at all and what we want to do is to delete them.
Now this entire video was prompted by a user who asked me for a macro that would delete every row in a worksheet if there was nothing in column A. So this the Developer tab and again by default it’s disabled so you want to just select it so that it is enabled and click Ok. And there’s an option here for Developer. And what you’re going to do is go to Customize Ribbon because only in 20 can you actually customize the Ribbon. To get the Developer tab there you’ll choose File and then Options. I’m actually going to close Excel 2007 because I’m going to work in 2010, but I just wanted to show you how you could get the Developer tab in 2007. With that selected the Developer tab then appears in the Ribbon. To make it visible you’ll click the Office button here, choose Excel Options and this is the option you want to enable Show Developer Tab in the Ribbon. First of all you need to make sure that this Developer tab is visible and it’s not by default.
In this tutorial I’m going to show you how you can create a macro in the Visual Basic Editor in Microsoft Excel.
Then how to create a new macro, save and run it. Covers displaying the Developer tab and how to create your Personal Macro Workbook so you can create and save macros.
Learn how to type a macro in Excel 2007/2010 & 2013.