decadence
Well-known Member
- Joined
- Oct 9, 2015
- Messages
- 525
- Office Version
- 365
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Hi, i am trying to merge cells together comma delimited, I am almost there but need help, Can someone help with this please.
This is what I end up with so far
<tbody>
</tbody>
But What I would like to do is this
From This
<tbody>
</tbody>
To This
<tbody>
</tbody>
Code:
Sub MergeCommaDel()
'
Dim objSelection, objCell As range, MyStr As String
Application.ScreenUpdating = False
On Error Resume Next
Set objSelection = Intersect(Selection, ActiveSheet.UsedRange)
For Each objCell In objSelection
MyStr = MyStr & VBA.Trim$(objCell) & ","
Next
With ActiveWindow
.Selection(1, 1).NumberFormat = "@"
.Selection(1, 1).Value = MyStr
End With
End Sub
This is what I end up with so far
a,b,c,d, | b | c | d |
<tbody>
</tbody>
But What I would like to do is this
From This
a | b | c | d |
<tbody>
</tbody>
To This
a,b,c,d | |||
<tbody>
</tbody>