Macro : Merge cell/row "above and below" with separator comma & 1 space

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all.,,
how to combine or merge cell (above and below) with multiple column, with separator mark comma (,) and 1 space
i want macro code work multiple column at simultance
here layout table
Kejari siak Nov-Des.xlsx
ABC
65data1data2data3
66MitsubishiMitsubishi L300Mitsubishi L300
67BM 9484 LDBM 9737 TMBM 8273 SH
68
69after macro
70data1data2
71Mitsubishi, BM 9484 LDMitsubishi L300, BM 9737 TM
basl

any help, thank
.sst
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
this is based on your post declaring the rows 65-67 containing source info and target rows 70 & 71

VBA Code:
Sub MergeData()
Dim LCol As Long, i As Double

LCol = Cells(65, Columns.Count).End(xlToLeft).Column

For i = 1 To LCol
    Cells(70, i) = Cells(65, i)
    Cells(71, i) = Cells(66, i) & ", " & Cells(67, i)
    Next i

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top