LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Conditional Button Enabling based on Checkbox

Just out of curiosity, why the CBool?

Force of habit. In VB6, the Value property of a CheckBox returns an
Integer, not a Boolean. I like to do the conversion to boolean myself --
self-documenting code and all that.

Just in case the TripleState property of the CheckBox is True, the better
code would be as follows:

Private Sub CheckBox1_Click()
With Me.TextBox1
If IsNull(Me.CheckBox1.Value) Then
.Enabled = False ' or True, as desired
Else
.Enabled = Me.CheckBox1.Value
End If
End With
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Chip:

Just out of curiosity, why the CBool?

Regards,

Vasant.

"Chip Pearson" wrote in message
...
Todd,

Try something like the following in the user form's code module:

Private Sub CheckBox1_Click()
Me.TextBox1.Enabled = CBool(Me.CheckBox1.Value)
End Sub


"Todd uttenstine" wrote in message
...
I have CheckBox1 and TextBox1 on a UserForm. What is the
code that would enable entry into TextBox1 if CheckBox1
has a check in it?

Thank you

Todd Huttenstine









 
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
Checkbox and conditional formating sed Excel Discussion (Misc queries) 3 November 8th 08 09:56 PM
Enabling voting button kd Excel Discussion (Misc queries) 0 April 24th 08 09:36 AM
Shrinking Checkbox and Radio Button Dennis C BroadWare Excel Discussion (Misc queries) 0 November 10th 06 03:01 PM
using a checkbox for a conditional function Brac Excel Worksheet Functions 4 December 8th 05 06:12 PM
Help with function to add percentage to cell based on checkbox. foxgguy2005 Excel Worksheet Functions 3 June 1st 05 05:52 AM


All times are GMT +1. The time now is 08:03 AM.

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"