Click here to Skip to main content
12,069,450 members (69,201 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 8:38am
Edited 29-Aug-12 6:30am
v3
Comments
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
 
good
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: 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[^]
  Permalink  
v2

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.160208.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2016
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