lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I am trying to copy a sheet to an external file (not opened). The code below did not work. Any help would be appreciated. Thank you. If that possible, can I also decided where to put the sheet (i.e. before the last one, after the first one etc)
I am trying to copy a sheet to an external file (not opened). The code below did not work. Any help would be appreciated. Thank you. If that possible, can I also decided where to put the sheet (i.e. before the last one, after the first one etc)
Code:
Sub copytoexternal()
Dim x As Workbook
Dim y As String
y = InputBox("file path and name")
Set x = Application.Workbooks.Open(y)
ThisWorkbook.ActiveSheet.Copy Destination:=x.Worksheets
End Sub