I have two workbooks: WbCode.xlsm containing my program code and WbData.xlsx containg a button to run the program that resides in WbCode.xlsm.
When both workbooks are opened, everything runs fine when pressing the button: the program does what it is supposed to do and the selected sheet in WbData.xlsx remains active (visible on my screen).
When only WbData.xlsx is open, something strange happens when pressing the button: Excel opens WbCode.xlsm and starts the program and the program does what it is supposed to do. But, when finished, WbCode.xlsm becomes active. I now have to select WbData.xlsx explicitly to see the result.
I already added
Workbooks("WbData.xlsx").Activate
at the end of the program, but no changes: WbCode.xlsm still becomes active.
Any suggestion to circumvent this annoying problem ?
Bookmarks