PDA

View Full Version : Solved: mergeing all date in each row



parscon
09-13-2012, 12:39 PM
I need a VBA code merge all cell data in row ,

That mean i have data on column A - B - C- D- E ... and whant all of them merge and be in column A and separate them with "," .

if you check sample file that i attched you will find what i need .

Thank you for your big help .

GarysStudent
09-13-2012, 02:07 PM
How about:



Sub MergeData()
Dim ary As Variant
Dim L As Long
Set r = Range("A1:XFD1")


Do
ary = r
merrg = ""
For L = 1 To
Columns.Count
If ary(1, L) <> "" Then
merrg = merrg & ary(1, L) & ","
End If
Next
If merrg = "" Then Exit Sub
merrg = Left(merrg, Len(merrg) - 1)
r.Clear
r(1) = merrg
Set r = r.Offset(1, 0)
Loop
End Sub

parscon
09-13-2012, 02:11 PM
Thank you for your reply but can not use this code , could you add into excel file and attach it .

Thank you very much .

parscon
09-13-2012, 02:14 PM
Thank you but your code does not work on this file :(

GarysStudent
09-13-2012, 02:19 PM
You are quite welcome!

Have A Great Day!

parscon
09-13-2012, 02:20 PM
Thank you but your code does not work on this file.
Please check the second attchment .