Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy sheets selected on user form
Try this Eileen
Private Sub CommandButton1_Click() Dim arr() As String Dim N As Integer N = 0 For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) = True Then N = N + 1 ReDim Preserve arr(1 To N) arr(N) = ListBox1.List(i) End If Next i If N = 0 Then MsgBox "You must select at least one Sheet" Exit Sub End If ThisWorkbook.Worksheets(arr).Copy Unload Me End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
vb code to copy and list selected row to diff sheets | Excel Discussion (Misc queries) | |||
Copy specific data form sheets into master sheet | Excel Worksheet Functions | |||
Sending user selected daa from cmblistbx to sheets of destination | Excel Programming | |||
Copy from User form to Sheet macro | Excel Programming | |||
Copy one spreadsheet into another without activating second spreadsheet's user form | Excel Programming |