Set a = createobject ("excel.application")
a.visible= True
Set b = a.workbooks.open ("D:\test1.xls")
Set c = a.workbooks.open ("D:\test2.xls")
Set d = b.worksheets (1)
Set e = c.worksheets (1)
For each cell in d.usedRange
If cell.value<>e.range (cell.address).value Then
cell.interior.colorindex=3
cell.font.color = vbgreen
else
cell.interior.colorindex=5
cell.font.color = vbred
End If
Next
a.quit ' If u want to close the excel then use this syntax
Set a=nothing
No comments:
Post a Comment