Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
matching full name to 'two column' name using sumproduct | Excel Worksheet Functions | |||
Why full contents of cell visible only by double clicking? | Excel Discussion (Misc queries) | |||
Formula: copy/concatenate cell contents matching condition | Excel Discussion (Misc queries) | |||
Copy contents of one cell to another based on matching in 2 other | Excel Discussion (Misc queries) | |||
matching cell contents | Excel Discussion (Misc queries) |