jski21
Board Regular
- Joined
- Jan 2, 2019
- Messages
- 133
- Office Version
- 2016
- Platform
- Windows
Good day most excellent Excellers,
Looking to import a specific sheet from a workbook that will always have the same 12 sheets (month names). Trying to create a message box that will ask for the month, use that as a variable for the sheet to import, and ultimately bring it into the workbook. This is a new frontier for me so I'm asking the super users here for a bit of assistance. Here's the code I've got so far (which doesn't work btw):
'Declared Variables
Dim PrgmInc As String
Dim SourceWB As Workbook
'Open Input Box and Ask User for month.
PrgmInc = Application.InputBox("Please provide the month for program income:", "PrgmInc", Type:=1)
'--------------------------------------------------------------------------------------------------------
'Sets the variables so as to bring in specified month tab from another workbook
Application.ScreenUpdating = False
Set SourceWB = Workbooks.Open("\\cd-srv2\acctgshare$\Program Income Reports\Receiving Warrants\Receiving Warrants 2022.xlsx\TAB NAME?")
SourceWB.Sheets("Sheet1").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
SourceWB.Close
Application.ScreenUpdating = True
'Turn On Screen Updating and Application Alerts
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Thanks in advance to all for the consideration and help.
jski
Looking to import a specific sheet from a workbook that will always have the same 12 sheets (month names). Trying to create a message box that will ask for the month, use that as a variable for the sheet to import, and ultimately bring it into the workbook. This is a new frontier for me so I'm asking the super users here for a bit of assistance. Here's the code I've got so far (which doesn't work btw):
'Declared Variables
Dim PrgmInc As String
Dim SourceWB As Workbook
'Open Input Box and Ask User for month.
PrgmInc = Application.InputBox("Please provide the month for program income:", "PrgmInc", Type:=1)
'--------------------------------------------------------------------------------------------------------
'Sets the variables so as to bring in specified month tab from another workbook
Application.ScreenUpdating = False
Set SourceWB = Workbooks.Open("\\cd-srv2\acctgshare$\Program Income Reports\Receiving Warrants\Receiving Warrants 2022.xlsx\TAB NAME?")
SourceWB.Sheets("Sheet1").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
SourceWB.Close
Application.ScreenUpdating = True
'Turn On Screen Updating and Application Alerts
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Thanks in advance to all for the consideration and help.
jski