Hi there,
i am trying to create a workbook out of a specific sheet (the name and location changes every time- based on need) from a different workbook. And this is how far i got with my code that gets stuck at line 16
any help is greatly appreciated!
thanks
i am trying to create a workbook out of a specific sheet (the name and location changes every time- based on need) from a different workbook. And this is how far i got with my code that gets stuck at line 16
Code:
Sub Button1_Click()
Dim ws As Worksheet
Dim wbNew As Workbook, wbCurrent As Workbook
Dim strFileName As String
'Assign object variables
Set wbCurrent = ActiveWorkbook
Set ws = wbCurrent.ActiveSheet
'Get desired file path from user
strFileName = InputBox("Enter File Name: ", "Creating New File...")
If strFileName <> "" Then
'copy whole current sheet
ws.Copy
Set wbNew = ws
wbNew.SaveAs wbCurrent.Path & "\" & strFileName
End If
End Sub
any help is greatly appreciated!
thanks