I'm using the below code. When the Macro completes, I'd like to add to the end to Copy (R17:S17) and paste down R:S (>row17) to the end of the current data (4 blank rows), or to row 2000 if needed.
Note, the Macro has a "stop" feature under certain comparisons. I only want it to run the above copy/paste when it actually completes and ends without being stopped.
Note, the Macro has a "stop" feature under certain comparisons. I only want it to run the above copy/paste when it actually completes and ends without being stopped.
Code:
Sub Updating_Strikes_Macro()
Dim lr As Long
Dim r As Long
Application.ScreenUpdating = True
'Find last row in column J with data
lr = Cells(Rows.Count, "J").End(xlUp).Row
'Loop through all rows starting in row 17
For r = 17 To lr
' If columns J and V are different and column J is not blank
If (Cells(r, "J") <> Cells(r, "V")) And (Cells(r, "J") <> "") Then
' Run code if they do not match
Rows(r).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A" & r & ":S" & r).Delete Shift:=xlUp
Range("J" & r).Copy
Range("V" & r).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("KB" & r).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
' If column J is blank and columns A and U are different
If (Cells(r, "J") = "") And (Left(Cells(r, "A"), 5) <> Left(Cells(r, "U"), 5)) Then
' What to do if columns A and U do not match
MsgBox "Columns A and U do not match on row " & r, vbOKOnly, "MACRO STOPPED!!!"
Exit Sub
End If
End If
Next r
Application.ScreenUpdating = False