Dao Ha Quang
New Member
- Joined
- Apr 30, 2023
- Messages
- 20
- Office Version
- 2016
Sub CopySheetFromClosedWB()
Application.ScreenUpdating = False
Filename = Application.GetOpenFilename("Excel Files (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm")
Set closedBook = Workbooks.Open(Filename)
closedBook.Sheets("Sheet1").Move Before:=ThisWorkbook.Sheets("TT")
closedBook.Close SaveChanges:=False
Application.ScreenUpdating = True
Call Macro2
End Sub
I use this code to copy 1 sheet from 1 closed file and then run "MACRO 2"
When I run it, it OPEN the file and I select the file, marco still runs normally,
but when I don't select file and CANCEL, my "MACRO 2" is still running and it crashes
I want "MACRO 2" to run only after I have selected OPEN a file
Thank you.