This code inserts a row as I want it to, but it inserts the row above the row containing 19 in column I and I want to insert the row below. How can I modify this code to insert the row below?
Dim i As Integer
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "C").End(xlUp).Row To 3 Step -1
If Cells(lRow, "I") = "19" Then Rows(lRow).EntireRow.Insert
Next lRow
CodePudding user response:
This bit of code might do the trick:
Rows(lRow).Resize(1).Insert xlUp
And if you need to insert more rows you can change the "1" with the appropriate number.
CodePudding user response:
You simply add 1 to the lRow
variable to specify the row you want.
Rows(lRow 1).EntireRow.Insert