Undo a change in a userform
Thanks! It works fine.
"Vergel Adriano" wrote:
You can keep track of the current selection by placing it in a user form
variable. Something like this in your form code module would work:
Private iCurrentIndex As Integer
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex < iCurrentIndex Then
If vbNo = MsgBox("Are you sure about this change?", vbYesNo) Then
ComboBox1.ListIndex = iCurrentIndex 'put the old selection back
End If
End If
End Sub
Private Sub ComboBox1_Enter()
iCurrentIndex = ComboBox1.ListIndex 'remember the current selection
End Sub
"gmore" wrote:
Hello folks!
Is it possible undo a change from a combo box into a userform? For instance,
if someone selects "A" in the list, the user must answer to a question to
valid that he or she really wants to cancel. If the user hits No, I would
like the program to bring back the value that was showing just before.
Thanks,
gmore
|