I have a large workbook with many worksheets. Each worksheet contains a combination of user inputs and calculations and most link to inputs or outputs on other worksheets. The workbook also has a module that contains a number of custom VBA functions.
I'm trying to automatically goalseek a cell located on an unselected/non-active worksheet if the user changes a value on the active sheet that is linked to the input for the calculation on the other sheet that I'd like to goalseek. An example:
Cell A1 on "Sheet7" contains a number that is a "guess" for a calculation result based upon the values in cells A2, A3, and A4 of the same sheet (example, A1 is the notional result of A2 + A3 + A4). Cells A2, A3, and A4 are links to calculation results from three other worksheets. Cell A5, on "Sheet7", is the actual result of A2 + A3 + A4 and it may not match the value in A1. Cell A6 is the difference between the calculated result in A6 and the value in A1 and I'm goalseeking A6 to 0 to ensure that the calculated value in A5 always matches the 'hard coded' value in A1.
I would like this goalseek to happen anytime the value of A2, A3, or A4 changes on "Sheet7" even if "Sheet7" is not selected when the change occurs. A2 may be linked to "Sheet2", A3 may be linked to "Sheet14", and A4 may be linked to "Sheet9". If the user has "Sheet2" selected and changes something that changes the value linked to cell A2 on "Sheet7" I'd like this macro to run (reason being that the "Sheet7" A1 value is linked back to a number of other worksheets and it's important that it remains updated or the entire calculation chain fails across the workbook).
All of the macro examples/posts I found work if I have "Sheet7" selected and change A2, A3, or A4 but if I have any of the other worksheets selected and make a change that changes the linked values the macro will not run regardless of all the code variants I've tried.
I do not have a good handle on the overall "VBA architecture" so can someone provide an answer in understandable terms and some direction on the specific things I need to do or code to add to the module or worksheet(s) (or both).
=A1in A2 it will never trigger A2 if it changes... only user-input triggers the change (or VBA itself)... so you need to keep track of the active sheet and changes cell to know what to look for...worksheetchangein the worksheet (only counts for that sheet) or in theThisWorkbook-module to do it for all sheets... but as said, just a differend outcome of a formula wont trigger it. And even having a lot of text here, I still do not get your real problem :/