Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can anyone help with _click() events?

I'm trying to display a form that cycles through a list of items and
displays checkboxes that are ticked or unticked depending on the item
properties.

I have written code that uses the _click() event to determine if the
status has changed (ie someone has ticked what was previously unticked /
vice versa) and then retrieve via an inputbox some more details which
are then inserted into the sheet.

HOWEVER, what seems to happen is that Excel is recognising the cycling
of items as being _click events and pops up the box for input whenever
the checkbox moves from unticked to ticked because the item it refers to
has that property even if you haven't clicked on the actual checkbox.

Am I missing something fundamental?

Any help gratefully received.

Peter

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can anyone help with _click() events?

Peter,

It would help if you show us the code, and explain what type of checkboxes
they are (worksheet forms, control toolbox or userforms).

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Peter" wrote in message
...
I'm trying to display a form that cycles through a list of items and
displays checkboxes that are ticked or unticked depending on the item
properties.

I have written code that uses the _click() event to determine if the
status has changed (ie someone has ticked what was previously unticked /
vice versa) and then retrieve via an inputbox some more details which
are then inserted into the sheet.

HOWEVER, what seems to happen is that Excel is recognising the cycling
of items as being _click events and pops up the box for input whenever
the checkbox moves from unticked to ticked because the item it refers to
has that property even if you haven't clicked on the actual checkbox.

Am I missing something fundamental?

Any help gratefully received.

Peter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can anyone help with _click() events?

Bob Phillips wrote:

Peter,

It would help if you show us the code, and explain what type of checkboxes
they are (worksheet forms, control toolbox or userforms).


OK, it's a user form laid out as follows...

SPIN Control TextBox Checkbox1 Checkbox2

As the spin button is moved up and down (corresponding to a unique ID) a
corresponding textbox.value is displayed together with the status of two
possible flags, checkbox1 and Checkbox2. Example:

Member_ID Name Committe_Member Attending_annual_trip
1 Jason Y N
2 Paul N Y

etc. (FYI this is an abstracted example, the actual usage would take too
long to explain!)

So, in this example when Paul gets elected to the committee I want to
put a tick in the box and add an e-mail address to a list (and vice
versa). If Jason decides to go on the trip I want to be able to place a
tick in the checkbox which will automatically fire up an input box that
asks how much money he is placing as a deposit.

My difficulty is this, if I move to a member_ID which has the
annual_trip button already checked then the input box pops up as if the
_click() event has fired. I could understand it if I had used _change()
as the displayed Checkbox2.Value will have "changed"

Hope this clarifies?

Peter
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Can anyone help with _click() events?

Hi Peter,

My difficulty is this, if I move to a member_ID which has the
annual_trip button already checked then the input box pops up as if the
_click() event has fired. I could understand it if I had used _change()
as the displayed Checkbox2.Value will have "changed"

Hope this clarifies?


Setting the value of a check box does indeed fire the _Click event. Most
people get around this by using a 'mbNoEvents' module-level variable:

Dim mbNoEvents As Boolean

'In the spin button code:
mbNoEvents = True
CheckBox1.Value = True
CheckBox2.Value = False
mbNoEvents = False

Private Sub CheckBox1_Click()

If mbNoEvents then Exit sub

'... do whatever
End Sub



Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can anyone help with _click() events?

Stephen Bullen wrote:

Setting the value of a check box does indeed fire the _Click event. Most
people get around this by using a 'mbNoEvents' module-level variable:

Dim mbNoEvents As Boolean

'In the spin button code:
mbNoEvents = True
CheckBox1.Value = True
CheckBox2.Value = False
mbNoEvents = False

Private Sub CheckBox1_Click()

If mbNoEvents then Exit sub

'... do whatever
End Sub


Many, many thanks for this. As it happens I'd worked something out on
the same lines embedded in the _click code but yours is a more elegant
solution.

Peter
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
events? [email protected] Excel Discussion (Misc queries) 1 September 14th 05 03:26 PM
Events ojv[_2_] Excel Programming 3 October 22nd 04 01:59 PM
events jacob Excel Programming 2 September 7th 04 02:15 PM
Need some events... Tim Mattingly Excel Programming 0 August 16th 04 09:53 AM
events Mark[_17_] Excel Programming 1 October 31st 03 09:18 AM


All times are GMT +1. The time now is 05:17 PM.

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

About Us

"It's about Microsoft Excel"