Hi,
I am completely new to this forum. Not sure if I am doing this correct.
I have a column (Column 5) which contain cells with strings separated by commas (example: Cell 2: F1, F2, F3, Cell 3: F4, F5, F6 etc). I am trying to find mistakes or duplicate values in these cells.
I took these cells (strings) and separated them in columns and using conditional formatting, It can highlight duplicate strings (if any) in red.
Next, I was trying to concatenate all these columns into the original cell by keeping the format (highlighted color) so the user can see what's has been duplicated.
When I concatenate, the format is lost. I am stuck looking for an answer on this.
I have this so far but the color is not being transfer when performing the macro:
Sub ConcatenateRefDesCol()
Dim result As String
Dim separator As String
Dim Temp As String
separator = ","
Last_Row = Sheets("Sheet1").Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
For j = 2 To Last_Row
Last_Column = Cells(j, ActiveSheet.Columns.Count).End(xlToLeft).Column
If Last_Column <> 1 Then
For i = 1 To Last_Column
If i <> Last_Column Then
Temp = Cells(j, i).Value
result = result & Temp & separator & " "
Else
Temp = Cells(j, i).Value
result = result & Temp
End If
Next i
Range("E" & j).Value = result
Range(Cells(j, 2), Cells(j, Last_Column)).Select
Selection.ClearContents
Temp = ""
result = ""
i = 0
Else
End If
Next j
End Sub
ColumnWithCells.png
Bookmarks