VBA - Combine multiple columns into single column

lj97

New Member
Joined
Jul 11, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
G'day 😃


I am needing to combine data from multiple columns into a single column.

The column name/header is in cell A1.

All data present needs to be in Column A.

I am needing each cell to only include one fruit name.

The data set is dynamic and changes regularly (i.e. sometimes there are more columns, sometimes there are less).

If anyone needs more info I am happy to provide it!

Thanks in advance :)(y)

P.s. I have attempted a few things in VBA. I have gotten close, but I am stuck on what to do when there is only one entry in a column (e.g. column F having only "Apple" in this example).

Combine columns into single column.xlsm
ABCDEF
1Fruit NameMelonMangoApplePearApple
2OrangeMelonMangoMangoMango
3ApplePearMangoMango
4PearPearMelonBanana
5ApplePearMelonBanana
6AppleMelonMelon
7AppleMelonMelon
8OrangePearMelon
9AppleMelonBanana
10AppleApple
11MelonMelon
12AppleMelon
13AppleMelon
14ApplePear
15ApplePear
16GrapesPear
17AppleMelon
18AppleMelon
19AppleBanana
20OrangeBanana
21AppleBanana
22AppleMelon
23AppleMelon
24AppleMelon
25ApplePear
26AppleMelon
27AppleApple
28Apple
29Apple
30Apple
31Apple
32Apple
33Apple
34Orange
35Apple
36Apple
37Orange
38Apple
39Grapes
40Orange
41Pear
Sheet1
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,224,820
Messages
6,181,157
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