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>
Guest 1Guest 1Guest 2
Jan van Dam
Erik van DamMarlieke Groot
Chris GrootNadine Vermeer
Joost van Dam

<colgroup><col style="width: 100px"><col width="100"><col width="100"></colgroup><tbody>
</tbody>


Wanted result:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
Guests
Jan van Dam
Erik van Dam
Marlieke Groot
Chris Groot
Nadine Vermeer
Joost van Dam

<colgroup><col style="width: 100px"></colgroup><tbody>
</tbody>
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,214,881
Messages
6,122,074
Members
449,064
Latest member
MattDRT

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