Want2BExcel
Board Regular
- Joined
- Nov 24, 2021
- Messages
- 114
- Office Version
- 2016
- Platform
- Windows
I found this answer from JohnnyL in this post VBA - Allow User to Select Which Worksheet to Copy
Its's almost what I need
Is it possible to choose multiple sheets and not only one from
....well it could be cool to write that path in the code also....along with filename based on a fixed string like "Schedule" and the value in two cells B1 and E1
Its's almost what I need
VBA Code:
Sub ChooseSheetNumberToUse() ' select a sheet to copy
'
Dim UserSelectedSheet As String
'
Worksheets(1).Activate ' Had to add this to allow the sheet selected to work
'
MsgBox "In the next popup window, Click the sheet name " & vbCrLf & "that you would like to copy." ' Advise user what to do next
'
If Application.CommandBars("workbook tabs").Controls(16).Caption Like "More Sheets*" Then ' This CommandBars only shows up to 16 sheets, after that it
' will display the first 15 sheets and the 16th item will be
' an option of "More Sheets..." which will give full list
Application.CommandBars("workbook tabs").Controls(16).Execute ' If more than 16 sheets are found, click the "More Sheets ..."
Else ' Otherwise ...
Application.CommandBars("Workbook Tabs").ShowPopup 800, 300 ' Display the sheets found
End If
'
UserSelectedSheet = ActiveSheet.Name ' Save the sheet name that the user selected
Debug.Print UserSelectedSheet ' Test print, for verification, name of user selected sheet
'
' The variable 'UserSelectedSheet' now contains the sheet name selected by the user
'
'
' Add desired additional coding here ...
'
End Sub
Application.CommandBars("Workbook Tabs").ShowPopup 800, 300
? And then save them all to a new workbook? The new workbook should stay active. So it easy to save it immediately to a path.....well it could be cool to write that path in the code also....along with filename based on a fixed string like "Schedule" and the value in two cells B1 and E1
Last edited: