For Barrie Davidson
Posted by Paul B on October 03, 2001 9:16 AM
Barrie the code that Qroozn posted was not what I was looking for, you posted this Marco awhile back. It added a row after text that was the same, if column A had test in row 1,2,3 and Price in rows 4,5,6 it would insert a row after row 3.Would you please modify it to show a input box so the number of rows to be inserted could be changed. Thanks
Sub Insert_row()
' Written by Barrie Davidson
Dim Number_of_rows As Long
Number_of_rows = ActiveSheet.UsedRange.Rows.Count
Range("A2").Select
Do Until Selection.Row = Number_of_rows + 1
If Selection.Value <> Selection.Offset(-1, 0).Value Then
Selection.EntireRow.Insert
Number_of_rows = Number_of_rows + 1
Selection.Offset(2, 0).Select
Else
Selection.Offset(1, 0).Select
End If
Loop
End Sub