Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Dynamically enable combo box if check box is checked

I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Dynamically enable combo box if check box is checked

in your userform_initialization sub, add

combobox6.enabled=false '<-- change to your combobox

then in your userform coding, you would add something like

private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub

so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.

hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Dynamically enable combo box if check box is checked

Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...

"Susan" wrote:

in your userform_initialization sub, add

combobox6.enabled=false '<-- change to your combobox

then in your userform coding, you would add something like

private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub

so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.

hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Dynamically enable combo box if check box is checked

hmmmm.
for that you'll need to add a boolean value, so the macro can tell if
it's being "checked" or "unchecked" - it only notices "clicked".

in your initialization sub, add

dim myBoolean as boolean

myBoolean=true


then in
private sub checkbox4_click()
if myboolean=true then
combobox6.enabled=true
myboolean=false
else
combobox6.enabled=false
myboolean=true
end if
end sub


1. so - userform opens - boolean value is true.
checkbox is checked the first time - combobox becomes enabled, boolean
value is set to false.

2. 2nd time checkbox is triggered, it runs thru the same private sub,
but this time the boolean value is NOT true, so it skips the 1st part
of the if statement. since boolean value is false, the 2nd part of
the if statement kicks in, dis-enabling the combobox & changing the
boolean back to true.

3. if it gets checked a 3rd time, it goes back to #1 above.

:)
susan


On Jun 20, 2:47 pm, MAWII wrote:
Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...



"Susan" wrote:
in your userform_initialization sub, add


combobox6.enabled=false '<-- change to your combobox


then in your userform coding, you would add something like


private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub


so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.


hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!


Mark- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Dynamically enable combo box if check box is checked

try
private sub checkbox4_click()
combobox6.enabled=checkbox4
end sub


"MAWII" wrote:

Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...

"Susan" wrote:

in your userform_initialization sub, add

combobox6.enabled=false '<-- change to your combobox

then in your userform coding, you would add something like

private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub

so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.

hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Dynamically enable combo box if check box is checked

Nevermind--I figured it out.

Thanks!

"MAWII" wrote:

Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...

"Susan" wrote:

in your userform_initialization sub, add

combobox6.enabled=false '<-- change to your combobox

then in your userform coding, you would add something like

private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub

so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.

hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Dynamically enable combo box if check box is checked

checkbox4.value is boolean (true or false), when ".value" left off, checkbox4
defaults to it's value. I know, it's kind of terse, but it works.

The click event occurs whether the checkbox is click to be "on" or clicked
to be "off". This code just makes use of the checkbox property ".value".



"Susan" wrote:

hmmmm.
for that you'll need to add a boolean value, so the macro can tell if
it's being "checked" or "unchecked" - it only notices "clicked".

in your initialization sub, add

dim myBoolean as boolean

myBoolean=true


then in
private sub checkbox4_click()
if myboolean=true then
combobox6.enabled=true
myboolean=false
else
combobox6.enabled=false
myboolean=true
end if
end sub


1. so - userform opens - boolean value is true.
checkbox is checked the first time - combobox becomes enabled, boolean
value is set to false.

2. 2nd time checkbox is triggered, it runs thru the same private sub,
but this time the boolean value is NOT true, so it skips the 1st part
of the if statement. since boolean value is false, the 2nd part of
the if statement kicks in, dis-enabling the combobox & changing the
boolean back to true.

3. if it gets checked a 3rd time, it goes back to #1 above.

:)
susan


On Jun 20, 2:47 pm, MAWII wrote:
Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...



"Susan" wrote:
in your userform_initialization sub, add


combobox6.enabled=false '<-- change to your combobox


then in your userform coding, you would add something like


private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub


so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.


hth!
susan


On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!


Mark- Hide quoted text -


- Show quoted text -




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Dynamically enable combo box if check box is checked

I used the following...

Private Sub checkbox1_click()

If checkbox1.Value = False Then
combobox1.Enabled = False
Else
combobox1.Enabled = True
End If

End Sub

Seemed a lot easier to me and I figured it out shortly after the request.
It does the trick. Thanks for the help!

Mark

"Steve the large" wrote:

checkbox4.value is boolean (true or false), when ".value" left off, checkbox4
defaults to it's value. I know, it's kind of terse, but it works.

The click event occurs whether the checkbox is click to be "on" or clicked
to be "off". This code just makes use of the checkbox property ".value".



"Susan" wrote:

hmmmm.
for that you'll need to add a boolean value, so the macro can tell if
it's being "checked" or "unchecked" - it only notices "clicked".

in your initialization sub, add

dim myBoolean as boolean

myBoolean=true


then in
private sub checkbox4_click()
if myboolean=true then
combobox6.enabled=true
myboolean=false
else
combobox6.enabled=false
myboolean=true
end if
end sub


1. so - userform opens - boolean value is true.
checkbox is checked the first time - combobox becomes enabled, boolean
value is set to false.

2. 2nd time checkbox is triggered, it runs thru the same private sub,
but this time the boolean value is NOT true, so it skips the 1st part
of the if statement. since boolean value is false, the 2nd part of
the if statement kicks in, dis-enabling the combobox & changing the
boolean back to true.

3. if it gets checked a 3rd time, it goes back to #1 above.

:)
susan


On Jun 20, 2:47 pm, MAWII wrote:
Thanks! That works great--how do I get it to disable the combobox if the
checkbox is unchecked again? Right now, the combobox enables when the
checkbox is checked, but stays enabled if the checkbox is clicked again...



"Susan" wrote:
in your userform_initialization sub, add

combobox6.enabled=false '<-- change to your combobox

then in your userform coding, you would add something like

private sub checkbox4_click() '<-- change to your checkbox
combobox6.enabled=true
end sub

so when checkbox4 is clicked (or "checked"), combobox6 automatically
becomes enabled.

hth!
susan

On Jun 20, 2:16 pm, MAWII wrote:
I have a userform with multiple combo boxes. I also have a check box as a
response to a question on the form. If checked, I would like the combo box
for the next question enabled. By default, I want the same combo box
disabled. How do I do this dynamically? Thanks!

Mark- Hide quoted text -

- Show quoted text -




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
Sum of check boxes that have been checked confused??[_2_] Excel Worksheet Functions 2 September 3rd 09 05:17 AM
all the check boxes should be checked if i check a particular checkbox in that row [email protected] Excel Programming 3 April 18th 07 09:20 AM
Password when Check Box is checked Johnny Excel Programming 5 January 31st 07 07:39 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
How do I get a Check Box to set a value in a cell when is checked. aaarbelo Excel Programming 1 March 26th 05 05:55 PM


All times are GMT +1. The time now is 12:43 AM.

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"