I am writing a macro where there is a central input sheet – let us call this sheet – “Main Input sheet” where user inputs the variables concerned. In the “Main Input sheet” there are some inputs say – “Any More Input sheets?” – which when “Yes”, a worksheet corresponding to the input is displayed (it was previously hidden) – Lets call it “Associated Input sheet”. Now, I want to ensure that the user updates “Associated Input sheet” before he runs the macro. Is there a way I can do this – using event handlers that VBA provides or using any other way?
Share
There is a Worksheet_change event that would probably do what you want:
Place this in the code for the “Main Info Sheet” and it will run everytime the sheet is changed.
However, if you don’t want the spreadsheet to run every single time the sheet is updated, but only want to check if it has been updated… what you can do is create a global variable like this (the declaration must be placed in a standard module:
Then you would simply put this line of code in the worksheet_changed macro:
Just make sure to always set the variable back to false after running your other macro. Is this what you’re looking for?