I have been trying to use this code to add / copy / insert row. But not working
Sub INSERTROWS()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet
'Set the first and last row to loop through
Firstrow = 5
Lastrow = 500
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'We check the values in the R column in this example
With .Cells(Lrow, "R")
If Not IsError(.Value) Then
If .Value = "ADD" Then ActiveCell.Offset(1, 0).EntireRow.Select Selection.Insert Shift:=xlDown
'This will delete each row with the Value "ADD"
'in Column R, case sensitive.
End If
End With
Next Lrow
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub
Bookmarks