ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Change Events (https://www.excelbanter.com/excel-programming/386519-worksheet-change-events.html)

Philip J Smith

Worksheet Change Events
 
Hi

Chip Pearson's notes on these state that these events do not occur when the
value is changed as the result of a calculation.

Is it also true that these events do not occur when the change is as a
result of a selection from a combo-box being changed?

Regards

Phil Smith



OssieMac

Worksheet Change Events
 
Hi Philip,

Correct. If you want an event to take place with the combo box change then
it is
Private Sub ComboBox1_Change()

As a little further info, if you are unsure if an event is taking place when
you don't want it to then during development, place a Msgbox as the first
line in each event. Use the sub name as the message something like this for
each event:-

Msgbox "Private Sub ComboBox1_Change" has been called.

Simply comment them out with a single quote when you no longer need them.

Regards,

OssieMac


"Philip J Smith" wrote:

Hi

Chip Pearson's notes on these state that these events do not occur when the
value is changed as the result of a calculation.

Is it also true that these events do not occur when the change is as a
result of a selection from a combo-box being changed?

Regards

Phil Smith



Philip J Smith

Worksheet Change Events
 
Hi Ossie Mac

Thanks for this.

Do I need to use the active x control rather than the forms combobox for
this to work?

Regards

Phil

"OssieMac" wrote:

Hi Philip,

Correct. If you want an event to take place with the combo box change then
it is
Private Sub ComboBox1_Change()

As a little further info, if you are unsure if an event is taking place when
you don't want it to then during development, place a Msgbox as the first
line in each event. Use the sub name as the message something like this for
each event:-

Msgbox "Private Sub ComboBox1_Change" has been called.

Simply comment them out with a single quote when you no longer need them.

Regards,

OssieMac


"Philip J Smith" wrote:

Hi

Chip Pearson's notes on these state that these events do not occur when the
value is changed as the result of a calculation.

Is it also true that these events do not occur when the change is as a
result of a selection from a combo-box being changed?

Regards

Phil Smith



Bob Phillips

Worksheet Change Events
 
One way is to have worksheet_calculate code monitoring the linked cell, like

Private Sub Worksheet_Calculate()
Select Case Me.Range("F1").Value
Case 1: MsgBox "First value selected"
Case 2: MsgBox "second value selected"
'etc
End Select
End Sub

and then reference the linked cell in another cell, just a simple =F1 say,
which will force the calculate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Philip J Smith" wrote in message
...
Hi Ossie Mac

Thanks for this.

Do I need to use the active x control rather than the forms combobox for
this to work?

Regards

Phil

"OssieMac" wrote:

Hi Philip,

Correct. If you want an event to take place with the combo box change
then
it is
Private Sub ComboBox1_Change()

As a little further info, if you are unsure if an event is taking place
when
you don't want it to then during development, place a Msgbox as the first
line in each event. Use the sub name as the message something like this
for
each event:-

Msgbox "Private Sub ComboBox1_Change" has been called.

Simply comment them out with a single quote when you no longer need them.

Regards,

OssieMac


"Philip J Smith" wrote:

Hi

Chip Pearson's notes on these state that these events do not occur when
the
value is changed as the result of a calculation.

Is it also true that these events do not occur when the change is as a
result of a selection from a combo-box being changed?

Regards

Phil Smith





Philip J Smith

Worksheet Change Events
 
Thanks. I changed from a change to a calculate event and the routine worked
perfectly.

"Bob Phillips" wrote:

One way is to have worksheet_calculate code monitoring the linked cell, like

Private Sub Worksheet_Calculate()
Select Case Me.Range("F1").Value
Case 1: MsgBox "First value selected"
Case 2: MsgBox "second value selected"
'etc
End Select
End Sub

and then reference the linked cell in another cell, just a simple =F1 say,
which will force the calculate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Philip J Smith" wrote in message
...
Hi Ossie Mac

Thanks for this.

Do I need to use the active x control rather than the forms combobox for
this to work?

Regards

Phil

"OssieMac" wrote:

Hi Philip,

Correct. If you want an event to take place with the combo box change
then
it is
Private Sub ComboBox1_Change()

As a little further info, if you are unsure if an event is taking place
when
you don't want it to then during development, place a Msgbox as the first
line in each event. Use the sub name as the message something like this
for
each event:-

Msgbox "Private Sub ComboBox1_Change" has been called.

Simply comment them out with a single quote when you no longer need them.

Regards,

OssieMac


"Philip J Smith" wrote:

Hi

Chip Pearson's notes on these state that these events do not occur when
the
value is changed as the result of a calculation.

Is it also true that these events do not occur when the change is as a
result of a selection from a combo-box being changed?

Regards

Phil Smith







All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com