如何在Excel VBA中将多个Excel工作表复制到1个变体 [英] How to copy several Excel sheets to 1 variant in Excel VBA
问题描述
我在Excel VBA中使用以下代码复制Excel表格进行计算:
I use the following code in Excel VBA to copy a Excel sheet for calculation:
Dim Store1Sheet() As Varient
Store1Sheet = Range("A1:D99")
StoreMultiSheet说,请您将如何将多个Excel工作表复制到1个变体中.
非常感谢.
____________________________________
我发现解决方法如下:
变暗的StoreMultiSheet(1到10)作为变体
变暗表没有整数
对于SheetNo = 1到10
StoreMultiSheet(SheetNo)=工作表(SheetNo).UsedRange
Next SheetNo
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
推荐答案
在您的代码中,您不会复制Excel工作表"到一个变量!
这些命令的意思是:
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
我不确定你想做什么...
请更具体地讲,改善您的问题,我将尝试升级我的答案.
有关MS Excel对象的更多信息: http://msdn.microsoft. com/en-us/library/office/aa209782%28v = office.10%29.aspx [ http://msdn.microsoft.com /en-us/library/office/aa269683%28v=office.10%29 [
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[^]
这篇关于如何在Excel VBA中将多个Excel工作表复制到1个变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!