Initialising ToggleButtons

  • Thread starter Thread starter Alec Kolundzic
  • Start date Start date
A

Alec Kolundzic

I am using the following code to initialise some
togglebuttons on opening a worksheet, but keep getting an
error message saying object required. What am I doing
wrong.

Thanks
Alec

Private Sub Workbook_Open()
With Worksheets("Sheet1")
ToggleButton1.Value = False
ToggleButton2.Value = True
ToggleButton3.Value = False
ToggleButton4.Value = True
ToggleButton5.Value = False
End With
End Sub
 
Hi Alec!

You have to add a dot before the ToggleButton rows, like:
Private Sub Workbook_Open()
With Worksheets("Sheet1")
..ToggleButton1.Value = False
..ToggleButton2.Value = True
..ToggleButton3.Value = False
..ToggleButton4.Value = True
..ToggleButton5.Value = False
End With
End Sub


Best regards

Stefan Hägglund
Microsoft
 
Thanks Stephan, that works a treat.
-----Original Message-----
Hi Alec!

You have to add a dot before the ToggleButton rows, like:
Private Sub Workbook_Open()
With Worksheets("Sheet1")
..ToggleButton1.Value = False
..ToggleButton2.Value = True
..ToggleButton3.Value = False
..ToggleButton4.Value = True
..ToggleButton5.Value = False
End With
End Sub


Best regards

Stefan Hägglund
Microsoft




.
 
Back
Top