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>
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,909
Office Version
365
Platform
Windows
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
 

Forum statistics

Threads
1,085,990
Messages
5,387,136
Members
402,045
Latest member
Hidalgo

Some videos you may like

This Week's Hot Topics

Top