![]() |
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. |
All times are GMT +1. The time now is 04:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com