View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Not 25, 35, 5351, just plain old 5?

Option Explicit
Sub testme01()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long

With Worksheets("sheet1")
FirstRow = 1
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row

For iRow = LastRow To FirstRow Step -1
If .Cells(iRow, "C").Value = 5 Then
.Rows(iRow + 1).Resize(2).Insert
End If
Next iRow
End With

End Sub

I used column C. Change that to what you need in two spots!

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Dr. Picou wrote:

Have a long column of numbers
Every time I see the number 5, I need to insert two rows. Doing this by
hand is tedious. Can you help me find a shortcut?
The IF function does not do this, right?


--

Dave Peterson