Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy an array of Sheets | Excel Discussion (Misc queries) | |||
Copy multiple sheets to seperate workbooks | Excel Discussion (Misc queries) | |||
combining cells and array from different sheets into an array to pass to IRR() | Excel Discussion (Misc queries) | |||
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? | Excel Worksheet Functions | |||
How to copy the work sheets from different workbooks into one? | Excel Discussion (Misc queries) |