Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.150302.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2015
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