If you're looking for a quick way to insert blank rows into your Excel spreadsheet, you might be surprised to find that there isn't a built-in Excel formula for this. However, you can create a macro (a script to automate a task) to add a specific number of rows to the desired location. Today, Mytour will show you how to write a simple macro to add new rows to your Excel sheet. Additionally, this guide will explain how to apply existing formulas to the newly added rows in the sheet.
Steps
Adding Rows to the Spreadsheet Using a Macro

Open the project in Excel. To begin, double-click the Excel document containing your data in Finder (Mac) or File Explorer (Windows). Alternatively, if Excel is already open, click File > Open and select the file containing the data you wish to process.

Check to ensure that the Developer tab is visible in the ribbon. If not, and you are using Windows, go to the File tab and click Options > Customize Ribbon. Under the 'Main Tabs' section, check the box next to 'Developer'. On a Mac, you can enable the Developer tab by clicking the Excel menu at the top of the screen, selecting Preferences, then clicking Ribbon & Toolbar. Check the 'Developer' box in the 'Customize this Ribbon' section and click Save.

Open the VBA editor. Click the Developer tab and select Visual Basic, or simply press Alt + F11.

Right-click on a worksheet. On the left-hand side of the window, you’ll see a list of sheets in the workbook. Right-click on one of the sheets to open a dropdown menu.

Hover over the Insert option and click on Module. When you hover over Insert, a menu will appear to the right of the current menu. Click Module to create a space for entering and executing VBA code.

Enter the following code into the VBA window:
Sub Insert_Rows_Loop()
Dim CurrentSheet As Object
' Loop through all selected sheets.
For Each CurrentSheet In ActiveWindow.SelectedSheets
' Insert 5 rows at the top of each sheet.
CurrentSheet.Range("a1:a5").EntireRow.Insert
Next CurrentSheet
End Sub
With this code, five rows will be inserted starting from A1 to A5 (five blank rows at the top of the sheet). You can modify the cell range to specify a different location, such as starting from the last row in the worksheet.
Press the F5 key. Alternatively, you can click the green Play button located above the code editor in the Visual Basic editor.

Click OK to continue. The rows will be inserted into the worksheet.
Add a formula to the newly inserted rows.

Open the project in Excel. To do this, double-click the Excel document containing the data in Finder (Mac) or File Explorer (Windows). Alternatively, if Excel is open, go to File > Open and select the file.
This method is useful if you want to learn how to copy existing formulas into the newly added rows.

Insert a row into the data. The shortcut keys you use will only add formulas from the row above, so the row you need to insert should be between or at the end of the data selection.
To insert a row, right-click the row below where you want to add the new row and select Insert.

Click on the cell in the new row where you want to apply the formula. Note: the keyboard shortcut will copy the formula from the cell above the one you selected.
The selected cell will be highlighted.

Press Ctrl + D. This shortcut fills the selected cell with the formula from the cell above it. It works on both Windows and Mac.
