ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CheckBox Ticked, ComboBoxBox visible? (https://www.excelbanter.com/excel-discussion-misc-queries/248581-checkbox-ticked-comboboxbox-visible.html)

Hoyos

CheckBox Ticked, ComboBoxBox visible?
 
I have the following code below only works when the userform is displayed. If
I un-check the checkbox which then hides a combobox. If then close the
userform and reopen it again the combobox is visible even though the checkbox
is not ticked.
How can I get over this problem?

Private Sub CheckBox62_Change()
If CheckBox62.Value = True Then
ComboBox7.Visible = True
Label106.Visible = True
Else
CheckBox62.Value = False
ComboBox7.Visible = False
Label106.Visible = False
End If
End Sub

om

CheckBox Ticked, ComboBoxBox visible?
 
Hi hoyos

add following to your code

Private Sub UserForm_Initialize()
ComboBox7.Visible = False
Label106.Visible = False
End Sub

Regards
Om

"hoyos" wrote:

I have the following code below only works when the userform is displayed. If
I un-check the checkbox which then hides a combobox. If then close the
userform and reopen it again the combobox is visible even though the checkbox
is not ticked.
How can I get over this problem?

Private Sub CheckBox62_Change()
If CheckBox62.Value = True Then
ComboBox7.Visible = True
Label106.Visible = True
Else
CheckBox62.Value = False
ComboBox7.Visible = False
Label106.Visible = False
End If
End Sub


Hoyos

CheckBox Ticked, ComboBoxBox visible?
 
Many thanks OM that works well.

"om" wrote:

Hi hoyos

add following to your code

Private Sub UserForm_Initialize()
ComboBox7.Visible = False
Label106.Visible = False
End Sub

Regards
Om

"hoyos" wrote:

I have the following code below only works when the userform is displayed. If
I un-check the checkbox which then hides a combobox. If then close the
userform and reopen it again the combobox is visible even though the checkbox
is not ticked.
How can I get over this problem?

Private Sub CheckBox62_Change()
If CheckBox62.Value = True Then
ComboBox7.Visible = True
Label106.Visible = True
Else
CheckBox62.Value = False
ComboBox7.Visible = False
Label106.Visible = False
End If
End Sub



All times are GMT +1. The time now is 02:47 PM.

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