Dim i As Variant
'For i = 1 To 5
For Each i In rngWatch
Dim c As Variant
c = rngWatch.Cells(i, 1).Value
If i <> rngReconcile.Cells(i, 1).Value Then
MsgBox i
End If
Next i
Выше цикл for и оператор if, где я потерян. Если значение из rngwatch
отсутствует в rngreconcile
то я хотел бы добавить значение в новый диапазон (еще не определен)
Sub Client_Dirty_Recon()
Dim Client_path As String
Dim Client_watchlist As Workbook
Dim Client_client_email As Workbook
Set Client_watchlist = ActiveWorkbook
Dim email_range As Range
Dim watchlist_range As Range
Dim wb As Workbook
Dim wbDirty As Workbook
Set wb = ThisWorkbook
Application.ScreenUpdating = False 'optional - screen will not flash
Client_path = Range("Path")
Workbooks.Open Client_path
Dim recon_list As Range
Set wbDirty = Workbooks.Open(Client_path)
Dim rngReconcile As Range
Dim rngWatch As Range
Set rngReconcile = wb.Sheets(1).Range("K:K")
Set rngWatch = wbDirty.Sheets(1).Range("A:A")
Dim i As Variant
'For i = 1 To 5
For Each i In rngWatch
Dim c As Variant
c = rngWatch.Cells(i, 1).Value
If i <> rngReconcile.Cells(i, 1).Value Then
MsgBox i
End If
Next i
ActiveWindow.Close Savechanges:=False
End Sub