Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
Moving togglebuttons Fugazy Excel Discussion (Misc queries) 0 August 15th 06 02:54 PM
ToggleButtons are strange Ken McLennan[_3_] Excel Programming 7 October 11th 04 09:40 AM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"