I'm trying to right a piece of code that merge the contents of 'column B'
were the contents of 'column A' is repeated.
I've attached my code below but unfortunately the Offset by one action does not work for me as there can be varios numbers of cells with the sage info.
I've attached an example dats/result set.
Sub Test()
Dim Cell As Range
For Each Cell In ActiveSheet.UsedRange
'Horizontal
'If Cell = Cell.Offset(0, 1) And Cell <> "" Then
' Cell.Offset(0, 1).ClearContents
' Range(Cell, Cell.Offset(0, 1)).Merge
'End If
'Vertical
If Cell = Cell.Offset(1, 0) And Cell <> "" Then
Cell.Offset(1, 0).ClearContents
Range(Cell, Cell.Offset(1, 0)).Merge
End If
Next Cell
End Sub
Bookmarks