200+ Video Lessons Show
Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.) View Course ()
Pexels You may want to clear all your work within a worksheet instead of creating a new sheet. If this is the case, you are in the right place. This article will show you how to create a button that will clear every row of a workbook excluding the first row. You'll need to keep the first row so you can keep your button handy for its next use. If you do not have the developer tab (the developer tab is needed in this tutorial) in Microsoft Excel find out how to make it visible here. Adding the Developer TabStep 1: Insert a ButtonFirst, click on the developer tab and choose the insert button. From the form control area of the drop-down, choose the button in the first row to the left. The steps are indicated by 1, 2, and 3 in the illustration below. Inserting a Form Control ButtonCreated by Joshua Crowder Next, drag the cursor somewhere in row 1 to create a button. After the outline of the button is drawn the Assign Macro box appears. Click on the record button. Drag CursorCreated by Joshua Crowder Step 2: Start Recording a MacroNext, the Record Macro window will appear. Name the macro and click OK. You can tell the macro is recording by the square stop button in the bottom left-hand corner of your screen this stop button will stop the macro at any time during recording. Name Macro & RecordCreated by Joshua Crowder Step 3: Select Area to be DeletedFor this worksheet, everything below row 1 needs to be cleared when the button is pressed. Start by selecting row 2. Now press Ctrl + Shift + Down arrow. This will select every row below row 1. Select AreaCreated by Joshua Crowder Step 4: Clear The AreaWhen all the rows are selected go to the home tab. Find the edit group and click on clear. Next click on clear all. Created by Joshua Crowder Step 5: Stop Recording The MacroPress Ctrl + home to get back to the top of the workbook if necessary and click somewhere in the worksheet to deselect the selected cells. Now click on the stop button to the right of “ready” in the bottom left-hand corner. Now the macro has finished recording and the button that was drawn earlier should appear. When the button is clicked it will clear any formatting or text below row 1. Formatting the ButtonTo format the button, right-click on the button and click on Format Control. Created by Joshua Crowder When the Format Control window appears, you will be given several options. Each tab option is listed in the table below. Make any necessary changes to format your button.
Created by Joshua Crowder Closing the WorkbookWhen using macros in workbooks they must be saved under the file name.XLSM to represent a macros workbook. If the workbook is not saved under this file extension, the macro you created will not function at all. To save, select the File tab then Save As. Select the location to save in and create a file name. Next, find Excel Macro-Enabled Workbook from the “Save as type” dropdown. Now save the workbook. Created by Joshua Crowder Additional ResourcePlease see the video below titled "Creating a Macro Button to Clear a Whole Worksheet" if you were unable to learn with the article. Creating a Macro Button to Clear a Whole WorksheetReferencesCrowder, J. (2020, January 1). How to Add the Developer Tab in Excel. Retrieved January 1, 2020, from https://youtu.be/nskuG6pK5ig. Related ArticlesTo learn more about developing in Excel, I recommend taking a look at the book Microsoft Excel 2019 VBA and Macros (Business Skills) by Bill Jelen to enhance your skills. This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional. © 2018 Joshua Crowder CommentsJoshua Crowder (author) from Tampa, FL on December 02, 2019: Thanks! I just wanted to show that everything can be deleted if you want. Farah Kiaei on February 27, 2019: Great idea that how much is important to clear every row of a workbook excluding the first row. |