LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default copy sheets selected on user form

Dim bFirst as Boolean
Dim i as long, wkbk as workbook
bFirst = True
for i = 0 to me.lstWorksheets.ListCount - 1
if me.lstworksheets.Selected(i) then
if bFirst then
worksheets(me.lstWorksheets.List(i)).copy
set wkbk = Activeworkbook
bFirst = False
else
worksheets(me.lstWorksheets.List(i)).copy _
After:=wkbk.Worksheets(wkbk.Worksheets.count)
end if
Next

--
Regards,
Tom Ogilvy

"Eileen" wrote in message
...
I have a workbook with several sheets. A user form lists the sheet names

in a
multi select list, lstWorksheets. When the user clicks OK, I want to copy

all
selected sheets to one new workbook. Can someone please help me with the

code
to accomplish this? Thanks.



 
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
vb code to copy and list selected row to diff sheets pvkutty Excel Discussion (Misc queries) 1 February 17th 10 12:05 PM
copy sheets selected on user form Ron de Bruin Excel Programming 0 August 19th 04 06:03 PM
Sending user selected daa from cmblistbx to sheets of destination No Name Excel Programming 0 February 18th 04 08:24 PM
Copy from User form to Sheet macro tas5tas Excel Programming 1 January 13th 04 03:54 AM
Copy one spreadsheet into another without activating second spreadsheet's user form P Cheek Excel Programming 3 July 23rd 03 06:26 PM


All times are GMT +1. The time now is 12:02 PM.

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

About Us

"It's about Microsoft Excel"