Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Change checkbox value

Hi,

So, on to my next dilemma - how do I change the value of a check box without
initiating a Checkbox_Change sub attached to it?

I have a check box (Sheet1.CheckBox1.Value = True) and changing the value to
false triggers the change event sub whether the check box is enabled or not.

It does not seem to matter if it is a Checkbox_Click() or Checkbox_Change()
event.

Any suggestions?

Thanks!

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Change checkbox value

mooresk257 wrote on 5/27/2010 :
Hi,

So, on to my next dilemma - how do I change the value of a check box without
initiating a Checkbox_Change sub attached to it?

I have a check box (Sheet1.CheckBox1.Value = True) and changing the value to
false triggers the change event sub whether the check box is enabled or not.

It does not seem to matter if it is a Checkbox_Click() or Checkbox_Change()
event.

Any suggestions?

Thanks!

Scott


Try...

Application.EnableEvents = False
Checkbox1.Value = False
Application.EnableEvents = True

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Change checkbox value

There may be easier ways (consider testing "application.events = false"
before you change the checkbox, and "application.events = true" immediately
after, that might work?)

but for straight (if inelegant) logic, add another variable

Sub Checkbox_Change
If MyVariable = True then
'all the code here
end if
End sub

Sub MyOtherProcedure
MyVariable = False
CheckboxA = True
CheckboxA = False
MyVariable = True
end sub

Of course, you will need to set MyVariable to True in the workbook_open
event, to make sure it is always enabled unless you decide to disable it. I
think an uninitialized variable will have a null value, so maybe you could
use that to your advantage, but again, I haven't tested that in actual use.

HTH,
Keith

"mooresk257" wrote:

Hi,

So, on to my next dilemma - how do I change the value of a check box without
initiating a Checkbox_Change sub attached to it?

I have a check box (Sheet1.CheckBox1.Value = True) and changing the value to
false triggers the change event sub whether the check box is enabled or not.

It does not seem to matter if it is a Checkbox_Click() or Checkbox_Change()
event.

Any suggestions?

Thanks!

Scott

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
Use a checkbox to change calculations Cmenkedi Excel Programming 3 December 9th 08 04:36 PM
Checkbox Name Change? J.W. Aldridge Excel Programming 3 August 10th 07 12:10 AM
how do i change the value of a cell with a checkbox Rollie13 Excel Worksheet Functions 3 November 24th 06 11:47 PM
checkbox value change pv78 Excel Programming 4 August 16th 06 04:49 PM
CheckBox Change Event Soniya[_4_] Excel Programming 2 April 26th 05 02:18 PM


All times are GMT +1. The time now is 06:08 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"