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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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