Hi. I have a spreadsheet where I added macros (attached to buttons) that filter information on a long report based on values in 1 column (the information is a department name). There are 7 different macros for the 7 departments. The code I used is
The Department is in the array ("D&C" in this instance. "PN" will appear in all the macros) and I named the Macro "Sub DC_Click()". All the other macros follow the same format with the department name changing. What I want to do is insert the Department name in a cell in the Header of the report based on what macro is running. So if the user selects this macro for "D&C", "D&C" will appear in cell E2 (not the "PN"). How would I do this? The code will need to say something like if Sub DC_Click() is run, insert "D&C" in cell E2; if Sub Legal_Click() is run, insert "Legal" in cell E2, etc., continuing for all 7 departments. Thank you.
Bookmarks