Forum Discussion
How can I create a last modified macro for each worksheet?
See the attached sample workbook. The code is in the ThisWorkbook module (under Microsoft Excel Objects in the Project Explorer pane of the Visual Basic Editor).
You'll have to allow macros when you open it, obviously.
Thanks for sending that over. I am very new to VBA. Would I need to change where it says "Summary" to the sheet name where I want to display it? And how do I pull the data in for each sheet?
Thanks for your help!
- HansVogelaarFeb 23, 2023MVP
Yes. Change the name Summary in the following line to the name you want to use.
Set wsh = Worksheets("Summary")The code will run automatically whenever you change a cell on a worksheet.
- jburrellFeb 23, 2023Copper ContributorThanks Hans. And when I copy the code to my own workshop, how do I get the code to run? Do I need to a formula into the cell I want it to appear? Thanks again (sorry for my lack of knowledge)
- HansVogelaarFeb 23, 2023MVP
Copy the code from the ThisWorkbook module in the sample workbook to the ThisWorkbook module of your own workbook.
Save your workbook as a macro-enabled workbook (*.xlsm), if it isn't a macro-enabled workbook already.
Make sure that you allow macros when you open it.