In the template there are a bunch of worksheets. One of them has VBA attached to the worksheet's Calculate event. If I have the template open, and then I open another workbook, the Calculate event fires for the worksheet, and I get an error on the following line of code:
Set myMACCont5 = Sheets("Mar Rep Pg2").Range("MACCont5")
Run-time error '9':
Subscript out of range
Now, I can go into Debug mode with this error. So, I do so. Then, I go to the workbooks and use CTRL-TAB to switch the view to make the template the active workbook. If I hit F5 to continue, Excel goes on it's merry way as if nothing was wrong. As long as the template is NOT the active workbook, I get this error message every time I do something that triggers the Calculate event (like hitting F9, or opening another file).
Any advice on what I can do? Is there maybe an If test I can wrap around my code to test if the template is the activeworkbook? Since it's a template, the filename is not as predictable as you might think. I'd need to address it's CURRENT filename, as a workbook, not just the template's filename.