Click here to Skip to main content
12,898,569 members (71,115 online)
Rate this:
Please Sign up or sign in to vote.
See more: MS-Excel VBA
I use the following code in Excel VBA to copy a Excel sheet for calculation:
Dim Store1Sheet() As Varient
Store1Sheet = Range("A1:D99")

Please would you adivse how to copy several Excel sheets to 1 variant, says StoreMultiSheet.

Many thanks.
I find the solution as follow:

Dim StoreMultiSheet(1 to 10) As Varient
Dim SheetNo As Integer

For SheetNo = 1 to 10
StoreMultiSheet(SheetNo) = Worksheets(SheetNo).UsedRange
Next SheetNo
Posted 28-Aug-12 7:38am
Updated 29-Aug-12 5:30am
Kenneth Haugland 28-Aug-12 13:43pm
MEaning 1 workbook with one sheet collected from different sheets, or just one workbook with multiple sheets?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In your code you don't "copy an Excel Sheet" to one variable!
These command's mean:
Dim Store1Sheet() As Variant 'declare variable, array of Variants
Store1Sheet = Range("A1:D99") ' set variable, type of object: array of Excel.Range

I'm not sure what you want to do...
Please, be more specific, improve your question and i'll try to upgrade my answer.

More about MS Excel objects:[^]
More about MS Visual Basic Reference:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100