LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Comparing Text between Columns

Hi, I would like to modify this macro such that it will allow my to search
one column of text against another and reveal where instances of column A
text occurs within column C. Essentially, I would like to have a VBA-version
of this formula "=IF(ISERROR(MATCH(A1,$C$1:$C$5,0)),"",A1)" (for reference to
what I'm trying to do, please see http://support.microsoft.com/kb/213367). I
tried to simply modify the search range but the macro ran with no results
(which I know is incorrect). Thank you for any help you can give. Note: the
two columns of data I wish to compare are; Column A -- ~10,000 server names,
Column C -- ~35,000 system names, and I want to find out which of those
column A servers are found in the column C list. Make sense?

Sub Find_Matches()
Dim CompareRange As Variant, x As Variant, y As Variant
' Set CompareRange equal to the range to which you will
' compare the selection.
Set CompareRange = Range("C1:C5")
' NOTE: If the compare range is located on another workbook
' or worksheet, use the following syntax.
' Set CompareRange = Workbooks("Book2"). _
' Worksheets("Sheet2").Range("C1:C5")
'
' Loop through each cell in the selection and compare it to
' each cell in CompareRange.
For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
End Sub

 
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 two columns of text values MYATT Excel Discussion (Misc queries) 2 September 24th 08 08:48 PM
comparing two columns of text angela9000 Excel Discussion (Misc queries) 2 June 13th 08 05:01 PM
comparing text values in two columns TD Excel Discussion (Misc queries) 6 June 10th 08 10:40 AM
Comparing Two Columns of Text sailortigger Excel Discussion (Misc queries) 2 June 21st 05 08:11 PM
Comparing text in columns Lear Excel Discussion (Misc queries) 1 June 8th 05 09:35 PM


All times are GMT +1. The time now is 10:20 AM.

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"