MixedUpExcel
Board Regular
- Joined
- Apr 7, 2015
- Messages
- 222
- Office Version
- 365
- Platform
- Windows
Hi,
I'm struggling to find the answer.. probably because the way I'm wording the search.
I have a Main Sub Routine which in turn Calls various smaller Sub Routines.
in the 1st Sub I assign a name to the active 'main' workbook eg.
then through the course of running the various Sub Routines, I have activated another workbook - done something to that and then need to reactivate the 'main' workbook again.
I'm now in a different Sub Routine than the one that I assigned 'workbooknamemain' to the Main Workbook.
I want 'workbooknamemain' to work in all sub routines after I've assigned the main workbook to it.
I've tried: Public workbooknamemain' As String above all Sub Routines in the Module (right at the top) but that didn't work.
What's the best way to do this please?
Thanks.
I'm struggling to find the answer.. probably because the way I'm wording the search.
I have a Main Sub Routine which in turn Calls various smaller Sub Routines.
in the 1st Sub I assign a name to the active 'main' workbook eg.
Code:
Dim workbooknamemain As String
workbooknamemain = ActiveWorkbook.Name
then through the course of running the various Sub Routines, I have activated another workbook - done something to that and then need to reactivate the 'main' workbook again.
I'm now in a different Sub Routine than the one that I assigned 'workbooknamemain' to the Main Workbook.
I want 'workbooknamemain' to work in all sub routines after I've assigned the main workbook to it.
I've tried: Public workbooknamemain' As String above all Sub Routines in the Module (right at the top) but that didn't work.
What's the best way to do this please?
Thanks.