VSTACK function in a macro to stack multiple table columns in a different table

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
I've trying to find anything I can on the use of the VSTACK function in a macro and come up empty. Just wondering if anyone here can point me in the right direction to be able stack multiple columns from a table into another table, but in one single column. Any help would be greatly appreciated. Thanks, SS
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You could do this in other ways in VBA, without using VSTACK.

But if you specifically wanted to use VSTACK, a simplistic example:
VBA Code:
Range("D2:D9").Value = Evaluate("VSTACK(A2:A4,B2:B6)")

'or

With Range("D2:D9")
    .Cells(1).Formula2 = "=VSTACK(A2:A4,B2:B6)"
    .Value = .Value 'optional
End With

ABCD
1InputOutput
2apa
3bqb
4crc
5sp
6tq
7r
8s
9t
Sheet1

These hard-coded cell references can be made dynamic of course.
 
Upvote 0
Solution
I like the second part of your response. I'll give that a try today. Thank you... I'll come back and let you know how it went.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
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