A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

ActiveX ToggleButton Reset



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2009, 08:14 PM posted to microsoft.public.excel.misc
John
external usenet poster
 
Posts: 2,649
Default ActiveX ToggleButton Reset

I have a sheet with several hundred ActiveX Toggle buttons. After running
some code, I need to reset them all so their value = False. Is there a way to
do with with out typing out ToggleButtonX.Value = False 300+ times?

Thanks!
  #2  
Old May 13th, 2009, 10:36 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default ActiveX ToggleButton Reset

You could use a macro like:

Option Explicit
Sub testme02()
Dim OLEObj As OLEObject
Dim wks As Worksheet

Set wks = Worksheets("Sheet1")

For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is msforms.ToggleButton Then
OLEObj.Object.Value = False
End If
Next OLEObj

End Sub


John wrote:

I have a sheet with several hundred ActiveX Toggle buttons. After running
some code, I need to reset them all so their value = False. Is there a way to
do with with out typing out ToggleButtonX.Value = False 300+ times?

Thanks!


--

Dave Peterson
  #3  
Old May 13th, 2009, 11:27 PM posted to microsoft.public.excel.misc
Chip Pearson
external usenet poster
 
Posts: 1,343
Default ActiveX ToggleButton Reset

Try some code like


Sub ResetToggles()
Dim WS As Worksheet
Dim OleObj As OLEObject
Set WS = Worksheets("Sheet2")
For Each OleObj In WS.OLEObjects
If TypeOf OleObj.Object Is MSForms.ToggleButton Then
OleObj.Object.Value = False
End If
Next OleObj
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Wed, 13 May 2009 12:14:39 -0700, John
wrote:

I have a sheet with several hundred ActiveX Toggle buttons. After running
some code, I need to reset them all so their value = False. Is there a way to
do with with out typing out ToggleButtonX.Value = False 300+ times?

Thanks!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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