Hi!
I'm trying to copy a sheet to the end of another workbook, but my code does not do it. It opens the dialog box just fine but returns a object - error.
I also tried to tweek it so that it could not open the chosen workbook, but to no avail.
Thanks for your help!
I'm trying to copy a sheet to the end of another workbook, but my code does not do it. It opens the dialog box just fine but returns a object - error.
I also tried to tweek it so that it could not open the chosen workbook, but to no avail.
Thanks for your help!
Code:
Sub code()
Dim wb As Workbook
Dim my_FileName As Variant
Set wb = ThisWorkbook
my_FileName = Application.GetOpenFilename '(FileFilter:=”Excel Files,*.xl*;*.xm*”)
If my_FileName <> False Then
Workbooks.Open Filename:=my_FileName
my_FileName.Copy After:=wb.Sheets(Sheet.Count)
my_FileName.Close SaveChanges:=False
End If
my_FileName.Copy After:=wb.Sheets(Sheets.Count)
End Sub