asddsa88
05-14-2010, 06:07 AM
Hello, I have a column with some names.
I am looking for a macro that finds all the duplicates and appends some text to their cell value, but I want to leave the last duplicate unchanged...
example:
COLUMN A:
scott
mary
scott
scott
macro executed--->column A now is
scott "appended text"
mary
scott "appended text"
scott
note that the last scott is unchanged!
I was thinking to use conditional formatting, but I don't know how to tell excel that he needs to keep the last duplicate unchanged..
Range("A1:A9").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(a:a;a1)>1"
Selection.FormatConditions(1).ActiveCell.Value="appended text" & ActiveCell.Value
I am looking for a macro that finds all the duplicates and appends some text to their cell value, but I want to leave the last duplicate unchanged...
example:
COLUMN A:
scott
mary
scott
scott
macro executed--->column A now is
scott "appended text"
mary
scott "appended text"
scott
note that the last scott is unchanged!
I was thinking to use conditional formatting, but I don't know how to tell excel that he needs to keep the last duplicate unchanged..
Range("A1:A9").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(a:a;a1)>1"
Selection.FormatConditions(1).ActiveCell.Value="appended text" & ActiveCell.Value