LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Compare Data between 2 columns, Excel 2000 & 2003

Hello,

My worksheet has in column1 numbers (001, 002, 003, etc) and column2
has same type of numbers. But, I need to compare beginning with
column1 cell1 and check each cell in column2 if there is a match. If
column1 cell has no match in column2 then I need to change column1
background color to red.

This is the code I have so far but I'm having trouble figuring out how
to check all of column2 cells if there is a match and then continuing
in column1 cells.

Sub CompareData2()
'Compare Column1 cell to all column2 cells
Dim rngC1 As Range
Dim rngC2 As Range
Dim cf As String
Set rngC1 = Range("C4:C65000")
Set rngC2 = Range("D4:D65000")
With ActiveSheet
For Each c1 In rngC1
c1.Select
For Each c2 In rngC2
c2.Select
If c1.Value = c2.Value Then
MsgBox "MATCH" 'for test purpose
Exit For
Else
c1.Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If
Next
Next
End With
End Sub

Thank you for your help,
jfcby

 
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
Compare two columns of texts in Excel 2003 K Excel Discussion (Misc queries) 7 September 23rd 09 02:36 PM
MS Excel 2000 - Compare two lists of data. Jerry New Users to Excel 3 September 22nd 09 06:58 AM
Split Data 1 Column to 3 columns, Excel 2000 & 2003 jfcby[_2_] Excel Programming 2 March 17th 07 09:16 PM
Need help using VBA to compare data in Excel columns, then manipulating data Sam Hill Excel Programming 0 May 8th 06 05:55 PM
Compare Two Columns of Data Using VB Excel willik[_7_] Excel Programming 2 March 1st 04 02:16 PM


All times are GMT +1. The time now is 02:27 AM.

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

About Us

"It's about Microsoft Excel"