compare a value in two w/books

T

TUNGANA KURMA RAJU

Looking for a simple code for:
If this worksheet $b$2 value=other w/book sheet1 $h$2 value
then msg"value exists" and exit sub() ,if not do something else.(both
w/books are in same folder)
 
B

Bob Phillips

If Activesheet.Range("B2").Value =
Workbooks("other.xls").Worksheets("Sheet1").Range("H2") Then
Msgbox "Value exists"
End if

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
T

TUNGANA KURMA RAJU

Thanks ,but it is not working,compile error:expected expression error is
coming.What to do ?
 
B

Bob Phillips

Probably just NG wrap-around

If ActiveSheet.Range("B2").Value = _
Workbooks("other.xls").Worksheets("Sheet1").Range("H2") Then
MsgBox "Value exists"
End If


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
T

TUNGANA KURMA RAJU

Same error coming !

Bob Phillips said:
Probably just NG wrap-around

If ActiveSheet.Range("B2").Value = _
Workbooks("other.xls").Worksheets("Sheet1").Range("H2") Then
MsgBox "Value exists"
End If


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Top