Combo box change

G

Guest

Hello!

I've got a userform where I feed text boxes and combo boxes from some fields
on a sheet each time that form is initialized. In the UserForm_Initialize
procedure I feed my combo box cb_status like this :

Private Sub UserForm_Initialize()
With cb_status
.RowSource = ""
.AddItem "P"
.AddItem "C"
.AddItem "N"
.AddItem "A"
End With
cb_status.Text = Cells(1, 3) 'Get the value already entered from the sheet
End Sub

This works perfectly, but the problem occurs when it reaches the
cb_status_Change because I've got conditions in there which I would like the
program to take action only when the user selects a value on one own. I see
that the program considers that when it brings the value from the sheet (when
initializing the userform) cb_status.Text = Cells(1, 3) it is considered like
a change.

Private Sub cb_status_Change()
If cb_status.Value = "A" Then
If MsgBox("Are you sure to cancel?", vbYesNo + vbQuestion) = vbYes
Then
frm_Bid.Enabled = False
Else
cb_status.Value = ""
End If
Else
frm_Bid.Enabled = True
End If
End Sub

How do I tell the program not to take action when it doesn't come from a
human action, but I still want to see the info from the sheet showing as the
value? I hope I am clear with my explainations...

Thanks for your help!
gmore
 
G

Guest

I just used "AfterUpdate" in my combo box and it seems to work fine. Any
other suggestions are welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top