View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lionel H Lionel H is offline
external usenet poster
 
Posts: 31
Default Comparing to tables of data to confirm they are the same or not

Roger,
Not sure why you just want a flag if the tables contains differences -
you've then got to go find them!
The following highlights the differing cells. (but puts you flag in as well
in case you use it for some other purpose)

Sub compare()
Range("A65") = "True" 'Assume the answer true
For i = 2 To 6
For j = 1 To 60
If Cells(j, i) = Cells(j, i + 5) Then
Cells(j, i).Interior.ColorIndex = 4 'green
Cells(j, i + 5).Interior.ColorIndex = 4 'green
Else
Cells(j, i).Interior.ColorIndex = 3 'red
Cells(j, i + 5).Interior.ColorIndex = 3 'red
Range("A65") = "False" 'go false if you ever come through here
End If
Next j
Next i
End Sub

"Roger on Excel" wrote:

I have a table with 5 columns and 60 rows which contains text and numerical
data.

The table is in columns B,C,D,E,F.

I would like to utilize a macro to compare this table with another table (in
columns G,H,I,J,K) for differences and to return a True or False value (in
cell A65) if they are the same or different.

can anyone help?

ThankYou,

Roger