Compare values in 2 workbooks

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

I want to test whether the values in 2 cells are equal.
The values will have the same reference but in different
workbooks.

I have something like this in mind...

Set a =
Set b =
If a.value = b.value Then
EndIf

if a is book1.xls and b is book2.xls and the cell
reference for each is Sheet1!A1 etc, how do I code these
references in VBA? Can if be done in the background or
does each sheet need to be activated.

Regards,

Walter
 
HI,
set a1=workbooks("book1").worksheets("sheet1").range("a1")

set a2=workbooks("book2").worksheets("sheet1").range("a1")
if a1=a2
 
Back
Top