you sure don't give much to go on...
what do you mean by "highlight"?
there are lots of ways to do what you're asking.
here's one I threw together.
it "highlights" by changing the font to bold and red:
Option Explicit
Sub IsPresent()
Dim bRow, cRow
'Reset previous "highlights"
Range("B3:B20").Select
Selection.Font.Bold = False
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Range("A1").Select
'Loop through range
For bRow = 3 To 20
For cRow = 3 To 99
If Cells(bRow, "B").Value = Cells(cRow, "C").Value Then
Cells(bRow, "B").Font.Color = vbRed
Cells(bRow, "B").Font.Bold = True
Exit For
End If
Next cRow
Next bRow
End Sub
Paul
________________________________
From: Mark Livingstone <[email protected]>
To: MS EXCEL AND VBA MACROS <[email protected]>
Sent: Wednesday, October 14, 2009 12:44:12 PM
Subject: $$Excel-Macros$$ How to match numbers from 2 columns with minimal
formulas
Hi.
I've been trying to put together VBA code that will allow me to match
2 columns with minimal Excel formulas.
There are 2 columns. 1st column (B3 to B20) has a set of numbers. 2nd
column (C3 to C99) has another set of numbers. I need to highlight
cells in the 1st column IF the cell's content matches any of the
numbers in the 2nd column.
Ideally, I would like to use VBA code only. Could anyone please cook
something up or provide a code that already exists?
Thanks!!!
--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain @ [email protected] or
Ashish Jain @ [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 6,500 subscribers worldwide and receive many nice notes about the
learning and support from the group. Our goal is to have 10,000 subscribers by
the end of 2009. Let friends and co-workers know they can subscribe to group at
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---