A somewhat cleaner way of building the “print sheet” that will show the contents of one of the other 50 sheets is to set cell A1
to
=INDIRECT($M$1 & "!A1")
which builds a text string that looks like the qualified name of the cell that you want to see, and then uses the INDIRECT()
function to de-reference that string (i.e., to treat it as a cell address and retrieve the contents of the identified cell). With this, you won’t need to change your formula(s) when you add Form51
. Warnings:
- This may cause Excel to do a lot of work (i.e., spend a lot of time) “recalculating” these indirect cells whenever anything changes (not just
M1
). I’m not sure whether it would be any worse than what you have now. - Be sure to avoid the temptation to change data or enter new data into the “print sheet” when you want to update
Form42
. (Of course, you have this issue now.) You may be able to protect yourself from such accidents by protecting the print sheet.
There are other ways to construct the print sheet; e.g., using VBA to
- create a user-defined function that might replace the
INDIRECT()
call, but operate more smoothly, or - actually copy all the data from
Formnn
to the print sheet whenever you change M1
.
You can count changes by writing a Worksheet_Change
VBA routine.
I don’t know any way for the sheet’s logic to be able to count/detect when you print it. However, you might be able to achieve the desired effect by writing a print routine in VBA. A
PrintOut, ,, True
statement will print the sheet for you; add whatever other actions you want (e.g., incrementing a counter). (You just have to remember to print using this macro.) The fourth parameter to PrintOut
is Preview, set to True
to have Microsoft Excel invoke print preview before printing the sheet (thus giving you the option to cancel) or False
(or omitted) to print the sheet immediately, unconditionally.
See How do I add VBA in MS Office? for information on, well, you know.