ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms (https://www.excelbanter.com/excel-programming/283724-forms.html)

[email protected]

Forms
 
What is the correctway to initialize a checkibox so that the check
mark appears? With this initialization, if
strFormBooleanReplaceConfirmEachChangeOption = "True" the program goes
to ChB05_Click

tia


Private Sub UserForm_Initialize()

If (strFormBooleanReplaceConfirmEachChangeOption = "True") Then
ChB05 = "True"
End If

end sub

Private Sub ChB05_Click()

If (bInitializationComplete = True) Then
If (strFormBooleanReplaceConfirmEachChangeOption = "False") Then
strFormBooleanReplaceConfirmEachChangeOption = "True"
Else
strFormBooleanReplaceConfirmEachChangeOption = "False"
End If
End If

End Sub

Henry[_5_]

Forms
 
Bob,

Clicking on a CheckBox toggles it's True/False value without code.
If you need to ensure that (bInitializationComplete = True) before you allow
the change then

Private Sub ChB05_Click()
'Click switches the value
If (bInitializationComplete = False) Then ChB05.Value = Not ChB05.Value
'This switches it back again
End Sub

Initialise the Checkbox with
ChB05.Value = True

HTH
Henry

wrote in message
...
What is the correctway to initialize a checkibox so that the check
mark appears? With this initialization, if
strFormBooleanReplaceConfirmEachChangeOption = "True" the program goes
to ChB05_Click

tia


Private Sub UserForm_Initialize()

If (strFormBooleanReplaceConfirmEachChangeOption = "True") Then
ChB05 = "True"
End If

end sub

Private Sub ChB05_Click()

If (bInitializationComplete = True) Then
If (strFormBooleanReplaceConfirmEachChangeOption = "False") Then
strFormBooleanReplaceConfirmEachChangeOption = "True"
Else
strFormBooleanReplaceConfirmEachChangeOption = "False"
End If
End If

End Sub





All times are GMT +1. The time now is 04:26 PM.

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