How to autofill formula when inserting rows in Excel?
When you insert blank rows between existing data rows, the formula will not copy and paste into the new row, you should drag or fill it manually. But, sometimes, you would like to fill the formula when you insert blank rows between data range automatically as following screenshot shown, this article, I will talk about some quick tricks to solve this task.
Auto fill formula when inserting blank rows with creating a table
Auto fill formula when inserting blank rows with VBA code
Auto fill formula when inserting blank rows with creating a table
In Excel, the Table format can help you to fill the above formula into the new inserted blank rows automatically, please do as follows:
1. Select the data range that you want to auto fill formula, and then click Insert > Table, see screenshot:
2. In the Create Table dialog, check the My table has headers if there are headers in your data, see screenshot:
3. Then click OK button, and the table has been created, and now, when you insert a blank row, the above formula will be inserted into the new row automatically, see screenshot:
Auto fill formula when inserting blank rows with VBA code
If you don’t like to change the data to table, the below VBA code also can help you to achieve this problem.
1. Select the worksheet tab which contains the formulas you want to auto fill, and right click to choose View Code from the context menu to go to the Microsoft Visual Basic for Applications window , and then copy and paste the following code into the Module:
VBA code: Auto fill formula when inserting blank rows
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Updateby Extendoffice 20160725
Cancel = True
Target.Offset(1).EntireRow.Insert
Target.EntireRow.Copy Target.Offset(1).EntireRow
On Error Resume Next
Target.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
End Sub
2. Then save and close this code, go back to the worksheet, now, when you double click a cell between the data, a new row will be inserted below the active cell and the formula is auto filled as well.
Demo: Auto fill formula when inserting blank rows
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!














