I am trying to add a procedure before the one below that will compare cell/s A10, A11, A12 etc with K10,K11,K12 respectively
For example; if A10 is less than K10 then message:"CC is missing"
If A10 in any of the sheets (array) does not match with sheet4 column A then message:"CC is invalid"
Only after that the procedure in blue (below) can be executed.
Sub MatchCopyPaste2()
Dim LR As Long, i As Long, ws As Worksheet
Application.ScreenUpdating = False
Sheets("DataByCC").UsedRange.Offset(1).ClearContents
For Each ws In Sheets(Array("P_ROLL", "Travel"))
With ws
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 10 To LR
With .Range("A" & i)
If IsNumeric(Application.Match(.Value, .Columns("A"), 0)) Then
.EntireRow.SpecialCells(12).Copy Destination:=Sheets("DataByCC").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With
Next i
End With
Next ws
End Sub
For example; if A10 is less than K10 then message:"CC is missing"
If A10 in any of the sheets (array) does not match with sheet4 column A then message:"CC is invalid"
Only after that the procedure in blue (below) can be executed.
Sub MatchCopyPaste2()
Dim LR As Long, i As Long, ws As Worksheet
Application.ScreenUpdating = False
Sheets("DataByCC").UsedRange.Offset(1).ClearContents
For Each ws In Sheets(Array("P_ROLL", "Travel"))
With ws
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 10 To LR
With .Range("A" & i)
If IsNumeric(Application.Match(.Value, .Columns("A"), 0)) Then
.EntireRow.SpecialCells(12).Copy Destination:=Sheets("DataByCC").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With
Next i
End With
Next ws
End Sub