BeforeUpdate event for Combo box

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Thanks for taking the time to read my question.

I have a combo box on one of the worksheets. Changing the
value in the combo box will affect many cells on the
worksheet. Therefore I would like to have a BeforeUpdate
event on the combo box where I would have a msgbox asking
if they are sure they really want to change the value.

I can get the Change event to fire, but not the
BeforeUpdate event. Any suggestions on how to get the
BeforeUpdate event to work?

Here is my code.

Thanks again,

Brad

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Private Sub ComboBox2_BeforeUpdate(ByVal Cancel As
MSForms.ReturnBoolean)
Dim answer As Variant

answer = MsgBox("Changing this value will delete the
current list of feeds, and numbers of birds per feed
stage. This will affect the Feed Stage Combo boxes on
this sheet. Do you wish to continue?", 36)
If answer = vbNo Then
Cancel = True
End If
End Sub

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Private Sub ComboBox2_Change()
GetProductNames
End Sub
 
Sub Feed()
If MsgBox("Are you sure?", vbYesNo) = vbNo Then
Exit Sub
'OR goto label1
End If

'label1:
'other code down here
End Sub



If you put this in the change event before your action
code, a msgbox would popup asking this. If you click no
it would exit sub. Or you can skip to another part of
your code using goto statement (which I have commented
out).

Is this what you want?

Todd
 

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

Back
Top