Here is my code to cut and past a row onto the exclusions sheet if it matches a value within the Yet_another_array
array, however its cutting and pasting all rows on Sheet Main
, ideally only 29 rows (the 29 UIDs within the Yet_another_array
array) should be cut and appended to the exclusions sheet.
ReDim aCheck(1 To LR, 1 To LC)
Dim ASR As Worksheet, LS As Worksheet
Set ASR = ActiveWorkbook.Sheets("Main")
Set LS = ActiveWorkbook.Sheets("Exclusions")
For i = 2 To LR
aCheck_Row = aCheck_Row + 1
aCheck(aCheck_Row, 1) = cells(i, cA) 'Security 'previously was fund #
Do
If IsError(Application.Match(aCheck(aCheck_Row, 1), Yet_Another_array, 1)) Then
'MsgBox "Found"
'If cells(i, 3) = Yet_Another_array(Yet_Another_array_Row, 1) Then
If IsError(Application.Match(cells(i, 3), Yet_Another_array, 0)) Then
ASR.cells(i, "C").EntireRow.Cut Destination:=LS.Range("A" & LS.Rows.Count).End(xlUp).Offset(1)
End If
End If
Exit Do
Loop While Not IsEmpty(aCheck)
Next i