What I would like is some advice and or suggestions as to how to deal with my next step. Ultimately what I am trying to do is; from a CommandButton select a Workbook from the list, then select a Sheet from a list of Sheets in that book, then copy and paste into that sheet.
I have put together the code below which gets me to the point of selecting the Workbook but stuck on how to then list the sheets in it before continuing.
Sub Part_works3b()
Dim ButtonChosen As Integer
Dim fd As FileDialog, fn As String, fp As String
'Safety Message#1 Displays message box on screen, _
with YES and NO buttons'
ButtonChosen = MsgBox("Do you want to continue", vbExclamation _
+ vbYesNo + vbDefaultButton2, "Warning")
If ButtonChosen = vbNo Then Exit Sub
'Change initial directory path "fp" to your desired folder'
fp = "C:\Users\usersname\Documents\My Documents\"
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.InitialFileName = fp & "*Invoice Book.xlsm"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
'change the zero to required # if AllowMultiSelect _
= True has been used'
fn = .SelectedItems(1)
'Safety Message#2 Displays message box on screen, _
with YES and NO buttons'
ButtonChosen = MsgBox("Do you want to continue", vbExclamation _
+ vbYesNo + vbDefaultButton2, "Warning")
If ButtonChosen = vbNo Then Exit Sub
'Code to Select Sheet from list & then copy & paste from _
other Sheet in other Book goes here'
Workbooks.Open (fn)
End If
End With
End Sub
My thoughts are, is a modification of this be feasible?
Sub ShowSheetLists()
Application.CommandBars("Workbook tabs").ShowPopup
End Sub
Bookmarks