Hi,
Hope you can help me.
I have a range in Workbook that I need to compare to another range in different workbook. If any cell not found I need to MegBox the offending cell and terminate the macro.
I have this but I got error message.
Sub Check()
'Dim Range1 As Range // not sure if I need to declare them
'Dim Range2 As Range // but when I do, I get the error message
Workbooks(Home1 & ".xls").Activate
Range1 = Sheets("Sheet1").Range("c3:c21")
Workbooks(Home2 & ".xls").Activate
Range2 = Sheets("Sheet1").Range("c11:c60")
For Each cell In Range1
If Not Range2.Find(cell.Value, LookIn:=xlValues) Is Nothing Then
MsgBox "This no where to find.", vbCritical, "Error!"
Stop
'If Not IsError(Application.Match(Cell.Value, Range2, 0)) Then
'// this also do not work
End If
Next
End Sub
Hope you can help me.
I have a range in Workbook that I need to compare to another range in different workbook. If any cell not found I need to MegBox the offending cell and terminate the macro.
I have this but I got error message.
Sub Check()
'Dim Range1 As Range // not sure if I need to declare them
'Dim Range2 As Range // but when I do, I get the error message
Workbooks(Home1 & ".xls").Activate
Range1 = Sheets("Sheet1").Range("c3:c21")
Workbooks(Home2 & ".xls").Activate
Range2 = Sheets("Sheet1").Range("c11:c60")
For Each cell In Range1
If Not Range2.Find(cell.Value, LookIn:=xlValues) Is Nothing Then
MsgBox "This no where to find.", vbCritical, "Error!"
Stop
'If Not IsError(Application.Match(Cell.Value, Range2, 0)) Then
'// this also do not work
End If
Next
End Sub