I have a Sub that loads a userform I created. In the sub, I change a label caption in the form and reuse it using a loop to capture the user's option selection for each new context (but with the same options presented).
I'd like to know how to tell the Sub that the 'X' close button was clicked so it doesn't continue to re-display the Userform.
I know the UserForm_QueryClose() Sub runs when the X is clicked but I don't know how to use that to tell the "calling" Sub that it was clicked. I tried creating a Public boolean variable in the code section for the userform and setting it to True when QueryClose would run but when it would return to the "calling" Sub, the variable wouldn't remain set to True.
Code:
Load frmExample
With ActiveSheet
For x = 1 To UBound(vValue)
.Cells(inputRow, vValue(x)).Select
frmExample.lblParameter.Caption = .Cells(inputRow - 1, vValue(x)).Value
frmExample.Show
'do things depending on which option button was selected
Next x
End With
I'd like to know how to tell the Sub that the 'X' close button was clicked so it doesn't continue to re-display the Userform.
I know the UserForm_QueryClose() Sub runs when the X is clicked but I don't know how to use that to tell the "calling" Sub that it was clicked. I tried creating a Public boolean variable in the code section for the userform and setting it to True when QueryClose would run but when it would return to the "calling" Sub, the variable wouldn't remain set to True.