Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Array Sheets Copy to new Workbooks

I would like to copy diffrent sheets to new workbook, but I have in many
ways error massage.

I tried take worksheets name to array with FOR .. NEXT,
I try copied multiselected sheets, with number index with the same
results - error massage (range error).

I selected diffrent sheets, that I'm doing well, but I have no idea how
to copy that union (more then 2 sheets).
tx and lol for all sugestion:)
Witek

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array Sheets Copy to new Workbooks

worksheets(Array(1,5,7)).Copy

or
Worksheets(Array("sheet1","Sheet5","Sheet7")).Copy

or
Dim varr as Variant
varr = Array(1,5,7)
worksheets(varr).Copy


--
Regards,
Tom Ogilvy


"Witek Kruk" wrote in message
...
I would like to copy diffrent sheets to new workbook, but I have in many
ways error massage.

I tried take worksheets name to array with FOR .. NEXT,
I try copied multiselected sheets, with number index with the same
results - error massage (range error).

I selected diffrent sheets, that I'm doing well, but I have no idea how
to copy that union (more then 2 sheets).
tx and lol for all sugestion:)
Witek

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Array Sheets Copy to new Workbooks

:))) I solved this problem, instead of Array and string variable I
declared Long variable and used simply Array() (redim etc) with "Long"
variable.

Dim bCount As Byte, m As Byte, lngArray() As Long

bCount = FrmPanel.lstLista2.ListCount
ReDim lngArray(1 To bCount)
For m = 1 To UBound(lngArray)
lngArray(m) = Worksheets(FrmPanel.lstLista2.List(m - 1)).Index
Next m
Worksheets(lngArray).Copy
End If
this work beautifull:)))
Tx Witek


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy an array of Sheets Aussiegirlone Excel Discussion (Misc queries) 4 July 12th 09 06:41 AM
Copy multiple sheets to seperate workbooks MY Excel Discussion (Misc queries) 1 October 15th 08 07:23 PM
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
How to copy the work sheets from different workbooks into one? Sesh Excel Discussion (Misc queries) 1 April 15th 05 06:03 PM


All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"