Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Comparing to tables of data to confirm they are the same or not

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Comparing to tables of data to confirm they are the same or not

Roger
This little macro will compare B1:F60 with G1:K60 and will place False
or True in A65 if a difference is found or not. Note that if there is a
difference, the code will not check beyond the first difference found. HTH
Otto
Sub TestCompare()
Dim i As Range
Dim Good As Boolean
Good = True
For Each i In Range("B1:F60")
If i < i.Offset(, 5) Then
Good = False
Exit For
End If
Next i
Range("A65") = Good
End Sub

"Roger on Excel" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing 2 tables Bobby Dreamer Excel Worksheet Functions 0 August 21st 08 06:11 AM
Comparing pivot tables entries with data in another worksheet Iain M[_2_] Excel Programming 0 November 26th 07 09:53 PM
Confirm Data from Other Cells Beep Beep Excel Programming 2 June 19th 07 09:26 PM
Comparing 2 pivot tables data using VBA [email protected] Excel Worksheet Functions 0 March 2nd 06 10:53 AM
Comparing data in tables Gerrym Excel Discussion (Misc queries) 2 March 3rd 05 08:07 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"