Combine 3 columns, but keep on separate rows

sjors86

New Member
Joined
Apr 19, 2018
Messages
1
I can't figure out how and if I can combine text from three different columns and place them in the same column, but in same row, I prefer an function.

Example:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>[TABLE="width: 0"]
<colgroup><col style="width: 100px"><col width="100"><col width="100"></colgroup><tbody>[TR]
[TD="align: center"]Guest 1[/TD]
[TD="align: center"]Guest 1[/TD]
[TD="align: center"]Guest 2[/TD]
[/TR]
[TR]
[TD]Jan van Dam[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Erik van Dam[/TD]
[TD]Marlieke Groot[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Chris Groot[/TD]
[TD]Nadine Vermeer[/TD]
[/TR]
[TR]
[TD]Joost van Dam[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Wanted result:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>[TABLE="width: 0"]
<colgroup><col style="width: 100px"></colgroup><tbody>[TR]
[TD="align: center"]Guests[/TD]
[/TR]
[TR]
[TD]Jan van Dam[/TD]
[/TR]
[TR]
[TD]Erik van Dam[/TD]
[/TR]
[TR]
[TD]Marlieke Groot[/TD]
[/TR]
[TR]
[TD]Chris Groot[/TD]
[/TR]
[TR]
[TD]Nadine Vermeer[/TD]
[/TR]
[TR]
[TD]Joost van Dam[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi & welcome to MrExcel.
How about
Code:
Sub CopyToOneCol()
   Dim Ary As Variant, Tmp() As Variant
   Dim UsdRws As Long
   Dim i As Long, j As Long, k As Long
   
   With ActiveSheet
      UsdRws = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).row
      Ary = .Range("A2:C" & UsdRws).Value
      .Range("A2:C" & UsdRws).ClearContents
      For i = LBound(Ary, 1) To UBound(Ary, 1)
         For j = LBound(Ary, 2) To UBound(Ary, 2)
            If Not Ary(i, j) = "" Then
               ReDim Preserve Tmp(k)
               Tmp(k) = Ary(i, j)
               k = k + 1
            End If
         
         Next j
      Next i
      .Range("A2").Resize(UBound(Tmp) + 1).Value = Application.Transpose(Tmp)
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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