I need some suggestions on error-handling help please. This is a rather obscure situation, but trust me, I need to do this.
I have two named cells, "CellA" and "CellB".
The macro enters a formula into CellA. The formula will vary. Basically, the macro must be free to write any formula in CellA that it's told, referencing any other cell(s) it's told, EXCEPT any formula which contains a reference to CellB. So examples of illegal formulas would include "=CellB", "=3*CellB", etc.
When such illegality is attempted, but before it's allowed to occur, there should be a message box, "I can't let you do that, Dave" and only offers the option to exit the sub.
Perhaps this could be accomplished via Excel validation?
I'd be grateful for any help.
I have two named cells, "CellA" and "CellB".
The macro enters a formula into CellA. The formula will vary. Basically, the macro must be free to write any formula in CellA that it's told, referencing any other cell(s) it's told, EXCEPT any formula which contains a reference to CellB. So examples of illegal formulas would include "=CellB", "=3*CellB", etc.
When such illegality is attempted, but before it's allowed to occur, there should be a message box, "I can't let you do that, Dave" and only offers the option to exit the sub.
Perhaps this could be accomplished via Excel validation?
I'd be grateful for any help.