Compare values in 2 workbooks

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
 
E

EdgeOfCity

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top