K. Georgiadis
02-07-2005, 10:40 AM
Gentlemen,
this is a follow up to a post of mine that was ultimately solved by Ken Puls on 12/4/04. Suddenly, however, the code stopped working, possibly because I changed something, somewhere accidentally
As a recap, my goal was to make certain worksheets appear if an option button was clicked and to hide them if the option button was cleared. Based on Ken Puls recommendation, I created an option button from the Control Toolbox and currently have the following code assigned to it:
Private Sub CheckBox1_Change()
Dim sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet, sh4 As Worksheet
Set sh1 = Worksheets("Book Value Based")
Set sh2 = Worksheets("Asset and Multiple Based")
Set sh3 = Worksheets("Synergies")
Set sh4 = Worksheets("Target Company's View")
If CheckBox1.Value = True Then
sh1.Visible = xlSheetVisible
sh2.Visible = xlSheetVisible
sh3.Visible = xlSheetVisible
sh4.Visible = xlSheetVisible
MsgBox "Please be certain to complete the following worksheets:" & vbNewLine _
& vbTab & sh1.Name & vbNewLine _
& vbTab & sh2.Name & vbNewLine _
& vbTab & sh3.Name & vbNewLine _
& vbTab & sh4.Name, vbOKOnly + vbExclamation, "Thank you!"
Else
sh1.Visible = xlSheetHidden
sh2.Visible = xlSheetHidden
sh3.Visible = xlSheetHidden
sh4.Visible = xlSheetHidden
End If
End Sub
Is there something wrong with the syntax? When I click on the option button, it remains selected but nothing happens an, in fact, I cannot even clear it (the option button is NOT in the design view). Each time I click on it, the following is added after the above listed code:
Private Sub OptionButton1_Click()
End Sub
I don't know if this code addition is deleterious or if it has nothing to do with my problem.
Your help is greatly appreciated.
KG
this is a follow up to a post of mine that was ultimately solved by Ken Puls on 12/4/04. Suddenly, however, the code stopped working, possibly because I changed something, somewhere accidentally
As a recap, my goal was to make certain worksheets appear if an option button was clicked and to hide them if the option button was cleared. Based on Ken Puls recommendation, I created an option button from the Control Toolbox and currently have the following code assigned to it:
Private Sub CheckBox1_Change()
Dim sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet, sh4 As Worksheet
Set sh1 = Worksheets("Book Value Based")
Set sh2 = Worksheets("Asset and Multiple Based")
Set sh3 = Worksheets("Synergies")
Set sh4 = Worksheets("Target Company's View")
If CheckBox1.Value = True Then
sh1.Visible = xlSheetVisible
sh2.Visible = xlSheetVisible
sh3.Visible = xlSheetVisible
sh4.Visible = xlSheetVisible
MsgBox "Please be certain to complete the following worksheets:" & vbNewLine _
& vbTab & sh1.Name & vbNewLine _
& vbTab & sh2.Name & vbNewLine _
& vbTab & sh3.Name & vbNewLine _
& vbTab & sh4.Name, vbOKOnly + vbExclamation, "Thank you!"
Else
sh1.Visible = xlSheetHidden
sh2.Visible = xlSheetHidden
sh3.Visible = xlSheetHidden
sh4.Visible = xlSheetHidden
End If
End Sub
Is there something wrong with the syntax? When I click on the option button, it remains selected but nothing happens an, in fact, I cannot even clear it (the option button is NOT in the design view). Each time I click on it, the following is added after the above listed code:
Private Sub OptionButton1_Click()
End Sub
I don't know if this code addition is deleterious or if it has nothing to do with my problem.
Your help is greatly appreciated.
KG