I have this Excel Macro which inserts a blank row above any cell in Column E that has the text "Shaped Bottom Finish" in it.
Although it does perform this action it also copies this text in every column in the last row available on the sheet creating a huge file. It also crashes Excel.![]()
Sub BlankLine() Dim Col As Variant Dim BlankRows As Long Dim LastRow As Long Dim R As Long Dim StartRow As Long Col = "E" StartRow = 1 BlankRows = 1 LastRow = Cells(Rows.Count, Col).End(xlUp).Row Application.ScreenUpdating = False With ActiveSheet For R = LastRow To StartRow + 1 Step -1 If .Cells(R, Col) = "Shaped Bottom Finish" Then .Cells(R, Col).EntireRow.Insert Shift:=xlDown End If Next R End With Application.ScreenUpdating = True End Sub
Can anyone see anything in the code that isn't quite right?
I would appreciate any help.
Bookmarks