Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
change the value of togglebuttons
Hello, I have a sheet with 120 toggle buttons.
What code can I write to turn the value of all buttons to true at the same time? I need something like this (which does not work :P): dim i as integer for i = 1 to 120 togglebutton & i.value = true next i thank you in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
change the value of togglebuttons
Nelson,
Two ways - the first does all togglebuttons regardless of name, 2nd does ToggleButton1, ToggleButton2, etc.: Sub test() Dim obj As OLEObject Dim tbutton As ToggleButton For Each obj In Worksheets("Sheet1").OLEObjects If TypeOf obj.Object Is ToggleButton Then Set tbutton = obj.Object tbutton.Value = True End If Next obj End Sub Sub test2() Dim obj As OLEObject Dim i As Integer For i = 1 To 120 Worksheets("Sheet1").OLEObjects("ToggleButton" & i).Object.Value = True Next i End Sub hth, Doug Glancy "Nelson" wrote in message ... Hello, I have a sheet with 120 toggle buttons. What code can I write to turn the value of all buttons to true at the same time? I need something like this (which does not work :P): dim i as integer for i = 1 to 120 togglebutton & i.value = true next i thank you in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel bar chart formatting of bars to change colors as data change | Excel Discussion (Misc queries) | |||
Use date modified to change format & create filter to track change | Excel Worksheet Functions | |||
Moving togglebuttons | Excel Discussion (Misc queries) | |||
ToggleButtons are strange | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming |