Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.46 KB | None | 0 0
  1. Private Sub CommandButton1_Click()
  2.     Const sDELIM As String = ", "
  3.     Dim rCell As Range
  4.     Dim sMergeStr As String
  5.     With Selection
  6.         For Each rCell In .Cells
  7.             sMergeStr = sMergeStr & sDELIM & rCell.Text
  8.             Next rCell
  9.             Application.DisplayAlerts = False
  10.             .Merge Across:=False
  11.             Application.DisplayAlerts = True
  12.             .Item(1).Value = Mid(sMergeStr, 1 + Len(sDELIM))
  13.     End With
  14. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement