dim statements for worksheets array

R

RichardVisteon

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

Chip Pearson

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



in message
news:[email protected]...
 
M

Maggie

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top