View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gmore gmore is offline
external usenet poster
 
Posts: 4
Default Combo box change

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