Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy multiple sheets using a list box


I'm trying to copy multiple sheets from one workbook to a new workbook.
The problem is that I'm trying to copy sheets one at a time using a
loop. The list box changes when the user enters different sheet names
into the list box. So far I have tried:

intcopy = 0

For intcopy = 0 To listbox1.Index
Sheets(Array(listbox1.List(intcopy))).Copy
intcopy = intcopy + 1
Next

With this code I get a 'Subscript of of range' error. I'd like the
selected sheets be put into one new workbook. Any suggestions?


--
kev_06
------------------------------------------------------------------------
kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=548008

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Copy multiple sheets using a list box

Try

Dim Ndx As Long
With Me.ListBox1
For Ndx = 0 To .ListCount - 1
If .Selected(Ndx) = True Then
Worksheets(.List(Ndx)).Copy
after:=Worksheets(Worksheets.Count)
End If
Next Ndx
End With



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



"kev_06"
wrote in message
...

I'm trying to copy multiple sheets from one workbook to a new
workbook.
The problem is that I'm trying to copy sheets one at a time
using a
loop. The list box changes when the user enters different sheet
names
into the list box. So far I have tried:

intcopy = 0

For intcopy = 0 To listbox1.Index
Sheets(Array(listbox1.List(intcopy))).Copy
intcopy = intcopy + 1
Next

With this code I get a 'Subscript of of range' error. I'd like
the
selected sheets be put into one new workbook. Any suggestions?


--
kev_06
------------------------------------------------------------------------
kev_06's Profile:
http://www.excelforum.com/member.php...o&userid=35046
View this thread:
http://www.excelforum.com/showthread...hreadid=548008



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
Top 20 list from multiple sheets Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 2 November 10th 08 08:59 PM
Copy data to multiple sheets HighlandRoss Excel Worksheet Functions 2 February 27th 08 08:38 PM
Copy & Past from multiple sheets to one Prometheus[_12_] Excel Programming 18 December 5th 05 12:36 AM
Multiple sheets selection and copy syaronc[_6_] Excel Programming 1 October 25th 04 12:40 PM
Copy from Multiple Sheets Eric[_23_] Excel Programming 3 August 5th 04 07:00 PM


All times are GMT +1. The time now is 08:09 AM.

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"