ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dim statements for worksheets array (https://www.excelbanter.com/excel-programming/354996-dim-statements-worksheets-array.html)

RichardVisteon

dim statements for worksheets array
 
I am creating a macro in visual basic 6 for excel .I came across some code in
vb help to fill across sheets, eg.
x = Array("Sheet1", "Sheet5", sheet7")
Sheet(x).FillAcrossSheets _
Worksheets("Sheet1").Range("A1:C5")
But I am having trouble dimentioning the above code. Any suggestions please.

Chip Pearson

dim statements for worksheets array
 
Try

Dim X As Variant
X = Array("Sheet1", "Sheet5", "sheet7")
Sheets(X).FillAcrossSheets _
Worksheets("Sheet1").Range("A1:C5")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"RichardVisteon" wrote
in message
...
I am creating a macro in visual basic 6 for excel .I came across
some code in
vb help to fill across sheets, eg.
x = Array("Sheet1", "Sheet5", sheet7")
Sheet(x).FillAcrossSheets _
Worksheets("Sheet1").Range("A1:C5")
But I am having trouble dimentioning the above code. Any
suggestions please.




Maggie

dim statements for worksheets array
 
Your issue was my issue...thx for the help, however, another question off of
this....

I have this code/macro saved in my personal macro wkbk, but how can I make
it work in a wkbk with same exact structure, different file and tab names?
Is there some sort of "currentwkbk" property or command I can use in the
code, instead of the specific sheet names?

"RichardVisteon" wrote:

I am creating a macro in visual basic 6 for excel .I came across some code in
vb help to fill across sheets, eg.
x = Array("Sheet1", "Sheet5", sheet7")
Sheet(x).FillAcrossSheets _
Worksheets("Sheet1").Range("A1:C5")
But I am having trouble dimentioning the above code. Any suggestions please.



All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com