Excel has a BeforePrint event which enables you run VBA code before a document is printed. This event can also be triggered by Print Preview. But not all Print Previews are the same.
The main use of the BeforePrint event is to set up the headers and footers for a print. You can link parts of the header and footer to a cell with this technique.
You usually test it by using Print Preview because that also triggers the BeforePrint event and stops you wasting paper.
Something I found out recently is that using the Print Preview in the File tab DOESN’T trigger the BeforePrint event.
I use the Print Preview Full Screen option (old school) see blog post here on how to add it to your Quick Access Toolbar – this triggers the BeforePrint event and can be used for testing and saving paper.