Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default OptionButton in a Form

I'm using 60 OptionButtons in a form. To initialize, I want all the
OptionButtons invisible. How can I index the OptionButtons with a For-Next
Loop to accomplish this? I've tried numerous approaches with no luck at
all... Plenty of error messages.

Any help appreciated.

Thanks,
Fred


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default OptionButton in a Form

Hi Fred,

Try:

'=======================
Private Sub UserForm_Initialize()
Dim oleObj As MSForms.OptionButton

For Each oleObj In UserForm1.Controls
If TypeOf oleObj Is MSForms.OptionButton Then
oleObj.Visible = False
End If
Next
End Sub

'<<=======================

---
Regards,
Norman



"Fred Russell" wrote in message
...
I'm using 60 OptionButtons in a form. To initialize, I want all the
OptionButtons invisible. How can I index the OptionButtons with a
For-Next Loop to accomplish this? I've tried numerous approaches with no
luck at all... Plenty of error messages.

Any help appreciated.

Thanks,
Fred




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default OptionButton in a Form

Probably best to declare the variable as Control

Dim oleObj As msforms.Control


--
HTH

Bob Phillips

"Norman Jones" wrote in message
...
Hi Fred,

Try:

'=======================
Private Sub UserForm_Initialize()
Dim oleObj As MSForms.OptionButton

For Each oleObj In UserForm1.Controls
If TypeOf oleObj Is MSForms.OptionButton Then
oleObj.Visible = False
End If
Next
End Sub

'<<=======================

---
Regards,
Norman



"Fred Russell" wrote in message
...
I'm using 60 OptionButtons in a form. To initialize, I want all the
OptionButtons invisible. How can I index the OptionButtons with a
For-Next Loop to accomplish this? I've tried numerous approaches with

no
luck at all... Plenty of error messages.

Any help appreciated.

Thanks,
Fred






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default OptionButton in a Form

Hi Bob,

Agreed!

---
Regards,
Norman



"Bob Phillips" wrote in message
...
Probably best to declare the variable as Control

Dim oleObj As msforms.Control


--
HTH

Bob Phillips

"Norman Jones" wrote in message
...
Hi Fred,

Try:

'=======================
Private Sub UserForm_Initialize()
Dim oleObj As MSForms.OptionButton

For Each oleObj In UserForm1.Controls
If TypeOf oleObj Is MSForms.OptionButton Then
oleObj.Visible = False
End If
Next
End Sub

'<<=======================

---
Regards,
Norman



"Fred Russell" wrote in message
...
I'm using 60 OptionButtons in a form. To initialize, I want all the
OptionButtons invisible. How can I index the OptionButtons with a
For-Next Loop to accomplish this? I've tried numerous approaches with

no
luck at all... Plenty of error messages.

Any help appreciated.

Thanks,
Fred








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default OptionButton in a Form

Thanks Norman and Bob, I really appreciate your help. Recommendation worked
just fine when using Norman's code with Bob's suggestion on the dimension
statement.

Dim oleObj As msforms.Control

Best regards,
Fred




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
optionbutton benb Excel Programming 1 March 29th 05 09:41 PM
OptionButton value Patrick Simonds Excel Programming 2 January 17th 05 10:50 AM
OptionButton nrage21[_70_] Excel Programming 0 September 29th 04 12:23 AM
Better Way to Use OptionButton [email protected] Excel Programming 4 September 1st 04 07:04 PM
which optionbutton is on Keyur Excel Programming 1 July 25th 04 05:49 AM


All times are GMT +1. The time now is 01:11 AM.

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

About Us

"It's about Microsoft Excel"