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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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