Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Matching contents of a cell full of text

I'm trying to write a macro that will compare the contents of two
nearby cells to see if they are identical. The cells all contain the
names of creative placements, so they are not numerical values.

I'm thinking something like,

sub test

if activecell.offset(5, -1) = activecell.offset(5,-2) then
Msgbox("These are the same")
' And then do any action I want
Else
Msgbox("These are not the same")
End if
End sub

does anybody know how to effectively do that first If statement?

Thanks,
-Brien

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Matching contents of a cell full of text

I suggest to try the following:

Sub CompareCells()
'Please note this macro assumes the entries are continuous.
'(Means there are no empty cells in between.)
Range("A1").Select 'This is your starting cell.
'Please edit cell address to fit your needs.
Do Until ActiveCell = Empty
If ActiveCell Like ActiveCell(0, 1) Then _
ActiveCell.Offset(0, 5).FormulaR1C1 = "Identical"
'Edit the offset as it fits your sheet.
Else
ActiveCell.Offset(0, 5).FormulaR1C1 = "Different"
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub



"brien downie" az alábbiakat írta a következo
hírüzenetben: ...
I'm trying to write a macro that will compare the contents of two
nearby cells to see if they are identical. The cells all contain the
names of creative placements, so they are not numerical values.

I'm thinking something like,

sub test

if activecell.offset(5, -1) = activecell.offset(5,-2) then
Msgbox("These are the same")
' And then do any action I want
Else
Msgbox("These are not the same")
End if
End sub

does anybody know how to effectively do that first If statement?

Thanks,
-Brien



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
matching full name to 'two column' name using sumproduct Carrach Excel Worksheet Functions 9 May 24th 10 02:32 PM
Why full contents of cell visible only by double clicking? Venkat Excel Discussion (Misc queries) 1 October 10th 08 05:24 PM
Formula: copy/concatenate cell contents matching condition Neil Hutchinson Excel Discussion (Misc queries) 4 September 2nd 08 09:51 AM
Copy contents of one cell to another based on matching in 2 other TerryB Excel Discussion (Misc queries) 1 February 22nd 07 09:54 AM
matching cell contents GARY Excel Discussion (Misc queries) 14 February 15th 06 11:30 AM


All times are GMT +1. The time now is 04:01 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"