I have a userform with two text boxes to search a worksheet based on the value in either text box. The form populates other boxes based on the active cell.
How can each sub check if the other has executed?
Pseudocode:
Sub StatusTextBox_AfterUpdate()
'Check if TransitTextBox_AfterUpdate() has run
If yes Then End Sub
If No Then Carry on with the rest of StatusTextBox_AfterUpdate()
This would change the value of the TransitTextBox
to pull from the worksheet, and I want to prevent the TransitTextBox_AfterUpdate()
from running.
As soon as the TransitTextBox
is populated the AfterUpdate
event runs and the two conflict. Is there a way of preventing this?
Use a Global variable to allow the two subs to communicate:
EDIT#1:
We need to make the communication variable visible across the board:
It should then be "visible" to subs, and events. See some of the answers Here