How to auto insert row based on cell value in Excel?

Insert row below based on cell value with VBA
Insert row above based on cell value with Kutools for Excel

Select Cells/Rows/Columns with one or two criteria in Excel |
The select Specific Cells of Kutools for Excel can quicky select all cells or rows or columns in a range based on one criterion or two criterion. Click for 30 days free trial! |
![]() |
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. |
Insert row below based on cell value with VBA
To insert row based on cell value by running VBA, please do as below steps:
![]() |
Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group as auto text, and liberate your brain! Click here to know Auto Text Click here to get free trial |
1. Press Alt + F11 keys simultaneously, and a Microsoft Visual Basic for Applications window pops out.
2. Click Insert > Module, then paste below VBA code to the popping Module window.
VBA: Insert row below based on cell value.
Sub BlankLine() 'Updateby20150203 Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type: = 8) Set WorkRng = WorkRng.Columns(1) xLastRow = WorkRng.Rows.Count Application.ScreenUpdating = False For xRowIndex = xLastRow To 1 Step - 1 Set Rng = WorkRng.Range("A" & xRowIndex) If Rng.Value = "0" Then Rng.Offset(1, 0).EntireRow.Insert Shift: = xlDown End If Next Application.ScreenUpdating = True End Sub
3. Click F5 key or the Run button, a dialog pops out, and select the column contains zero. See screenshot:
4. Click OK. Then blank rows will be inserted below zero value.
Tip:
1. If you want to insert rows based on other value, you can change 0 to any value you want in the VBA: If Rng.Value = "0" Then.
2. If you want to insert rows above zero or other value, you can use the below vba code.
VBA: Insert row above zero value:
Sub BlankLine() 'Updateby20150203 Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type: = 8) Set WorkRng = WorkRng.Columns(1) xLastRow = WorkRng.Rows.Count Application.ScreenUpdating = False For xRowIndex = xLastRow To 1 Step - 1 Set Rng = WorkRng.Range("A" & xRowIndex) If Rng.Value = "0" Then Rng.EntireRow.Insert Shift: = xlDown End If Next Application.ScreenUpdating = True End Sub
Insert row above based on cell value with Kutools for Excel
If you are not familiar with VBA, you can try Kutools for Excel's Select Specific Cells utility, and then insert rows above.
Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. | ||
After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)
1. Select the list you want to find out the specific cells from, and click Kutools > Select > Select Specific Cells. See screenshot:
2. In the popping dialog, check Entire row option, and then go to select Equals from Specific type list, and then enter the value you want to find in the right textbox. See screenshot:
3. Click Ok, and a dialog pops out to remind you the number of selected rows, just close it.
4. Place cursor at one selected row, and right click to select Insert from context menu. See screenshot:
Now the rows are inserted above based on a specific value.
Insert Rows Above Based On Cell Value
Relative Articles:
Tabbed browsing & editing multiple Excel workbooks/Word documents as Firefox, Chrome, Internet Explore 10! |
You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Excel workbooks or Word documents in one Excel window or Word window, and easily switch between them by clicking their tabs. Click for free 30-day trial of Office Tab! |
![]() |
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
- Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
- Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.

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!
