Hi,
I have the VBA code below which inserts a blank row above rows in a particular column when a value is in the code.
Sub InsertRow()
Dim Lastrow As Long
Dim I As Long
Application.ScreenUpdating = False
Lastrow = Range("AQ" & Rows.Count).End(xlUp).Row
I = 1
While I <= Lastrow
If (Len(Cells(I, "AQ")) <> Len(Replace(Cells(I, "AQ"), "N", ""))) Then
Rows(I & ":" & I).Insert Shift:=xlDown
I = I + 1
End If
I = I + 1
Lastrow = Range("AQ" & Rows.Count).End(xlUp).Row
Wend
Application.ScreenUpdating = True
End Sub
So in this case when Insert is in a cell in column AQ in adds in a blank row above that cell.
I want to adapt is to i can add it as a button so the tow important bits of information, the column and the text in the cell are asked for in a pop up to enter for the macro to run.
Hope that makes sense. Thank you in advance.
Kind Regards,
Heath
Bookmarks