12,292,969 members (66,198 online)
Rate this:
See more:
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
Edited 29-Aug-12 5:30am
v3
Kenneth Haugland 28-Aug-12 13:43pm

MEaning 1 workbook with one sheet collected from different sheets, or just one workbook with multiple sheets?

Rate this:

## 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...

More about MS Excel objects: http://msdn.microsoft.com/en-us/library/office/aa209782%28v=office.10%29.aspx[^]
More about MS Visual Basic Reference: http://msdn.microsoft.com/en-us/library/office/aa269683%28v=office.10%29[^]
v2

Top Experts
Last 24hrsThis month
 Dave Kreskowiak 465 OriginalGriff 370 Richard MacCutchan 365 ppolymorphe 300 CHill60 285
 OriginalGriff 8,465 ppolymorphe 5,247 CHill60 5,145 KARTHIK Bangalore 4,472 Sergey Alexandrovich Kryukov 4,426