Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default BeforeUpdate event for Combo box

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default BeforeUpdate event for Combo box

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


-----Original Message-----
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
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default BeforeUpdate event for Combo box

Thanks Todd,

Thats a good idea,

I'll give it a try.

Brad
-----Original Message-----
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


-----Original Message-----
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
.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I expose the TextBox BeforeUpdate event to my user class? bereid Excel Discussion (Misc queries) 0 November 30th 05 05:00 PM
Event Procedures: Event on Worksheet to fire Event on another Worksheet Kathryn Excel Programming 2 April 7th 04 07:35 PM
worksheet_change event with a combo box ice_cool Excel Programming 3 February 13th 04 03:11 PM
Help with a Combo Box Change Event Ruan[_3_] Excel Programming 1 October 28th 03 08:51 AM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"