S
SteveDB1
Hi.
A while back I recorded a macro to select a worksheet from one workbook, and
then place that into another workbook.
I'd like to take this to the next step where I choose the workbook.
I have the following code, and get a " subscript out of range" error.
Dim WkBkName As String
Dim WkBkName1 As String
'
Workbooks.Open Filename:= _
"C:\Documents and Settings\UserName\Application
Data\Microsoft\Templates\TR Claim Book.xlt" _
, Editable:=True
WkBkName = InputBox(Prompt:="enter workbook name of where to copy
worksheet", Title:="Copy worksheet to existing workbook")
WkBkName1 = "S:\Users Shared\UserName\DTR\Active Files\" & WkBkName & ".xlsx"
Sheets("Tab # ").Select
Workbooks(WkBkName1).Activate
Sheets("Tab # ").Copy After:=Workbooks(WkBkName1).Sheets(Sheets.Count)
When I click the debug button, and mouse over the line that's highlighted in
yellow
"Workbooks(WkBkName1).Activate"
it shows the name of my file in a small message box.
what am I missing?
Thank you.
A while back I recorded a macro to select a worksheet from one workbook, and
then place that into another workbook.
I'd like to take this to the next step where I choose the workbook.
I have the following code, and get a " subscript out of range" error.
Dim WkBkName As String
Dim WkBkName1 As String
'
Workbooks.Open Filename:= _
"C:\Documents and Settings\UserName\Application
Data\Microsoft\Templates\TR Claim Book.xlt" _
, Editable:=True
WkBkName = InputBox(Prompt:="enter workbook name of where to copy
worksheet", Title:="Copy worksheet to existing workbook")
WkBkName1 = "S:\Users Shared\UserName\DTR\Active Files\" & WkBkName & ".xlsx"
Sheets("Tab # ").Select
Workbooks(WkBkName1).Activate
Sheets("Tab # ").Copy After:=Workbooks(WkBkName1).Sheets(Sheets.Count)
When I click the debug button, and mouse over the line that's highlighted in
yellow
"Workbooks(WkBkName1).Activate"
it shows the name of my file in a small message box.
what am I missing?
Thank you.