Hi Matt
to run the code automatically you need to run it from the code for that particular sheet, not into the general module that applies to all sheets in the workbook. To do this:
- right click on the tab with the sheet name GANTT at the bottom of the sheet.
- Select view code – this will take you into the code area for that sheet.
You will see there is already a private sub in there called:
Worksheet_Change(ByVal Target As Range)
This is a macro that runs automatically when the sheet is changed. We also want our macro to do that, but because there can’t be two worksheet_change nmacros we’re going to have to modify the existing one rather than adding our own.
To do this, scroll down to the bottom of the macro, and just above the end sub insert this code
This check to see whether cell F7 has been altered, and if so, it runs the macro gantt_update.
I have uploaded a version with these modifications, so you can see how they work in practice.
Just remember you need both the macro in a normal module and the automation on the sheet’s code for this to work.
Cheers
Nicky
Bookmarks