Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default OptionButton. Reset to 0

Readers,

Can OptionButtons be set to 0, using something like For each - Next ??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 179
Default OptionButton. Reset to 0

try this one:

Me.OptionButton1.Value = True

pls do rate

"Eef Houniet" wrote:

Readers,

Can OptionButtons be set to 0, using something like For each - Next ??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,593
Default OptionButton. Reset to 0

me.oleobjects("OptionButton1").object.value=0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Eef Houniet" wrote in message
...
Readers,

Can OptionButtons be set to 0, using something like For each - Next

??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef




  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3
Default OptionButton. Reset to 0

Hello,

If your OptionButton is in a UserForm, you can reset the OptionButton
to 0 using the following:

For Each Control In UserForm.Controls
If Left(Control.Name, 12) = "OptionButton" Then
Control.Value = False
End If
Next Control

For me, I use a prefix for all control to help me do such loops.
Example for OptionButtons, I'd use "ob"
obFirstChoice,
obSecondChoice,
etc.

I hope this helps.
Karim

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default OptionButton. Reset to 0

Karim,

The OptionButtons are not on a UserForm, but on a Sheet
I tried te following procedu

Private Sub ButtonsEmpty()

Dim Sh As Worksheet
Set Sh = Sheets(1)
Dim Ct As Control

For Each Ct In Sh
Control.Value = 0
Next Control

End Sub


Does not work. ErrorMessage complains that no variable has been defined for
Value.
Where do I go wrong?

Thanking you in advance
Eef






"Benabd" schreef in bericht
ps.com...
Hello,

If your OptionButton is in a UserForm, you can reset the OptionButton
to 0 using the following:

For Each Control In UserForm.Controls
If Left(Control.Name, 12) = "OptionButton" Then
Control.Value = False
End If
Next Control

For me, I use a prefix for all control to help me do such loops.
Example for OptionButtons, I'd use "ob"
obFirstChoice,
obSecondChoice,
etc.

I hope this helps.
Karim





  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default OptionButton. Reset to 0

Muhammed,

Thank you for answering my question.
Your suggestion works for one OptionButton.

I worked this out as follows (I that there are 66 buttons):

Dim tel As Integer
Let tel = 1
Sheets("vragen").Activate
With ActiveSheet
Do While tel < 66
Me.OLEObjects("OptionButton" & tel).Object.value = 0
tel = tel + 1
Loop
End With

However, I think a construction using For Each - Next is better.
Any suggestions?
Thanking you in advance

Eef

"Muhammed Rafeek M" schreef in
bericht ...
try this one:

Me.OptionButton1.Value = True

pls do rate

"Eef Houniet" wrote:

Readers,

Can OptionButtons be set to 0, using something like For each - Next
??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef





  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default OptionButton. Reset to 0

Bob,

Thank you for answering my question.
Your suggestion works for one OptionButton.

I worked this out as follows (I that there are 66 buttons):

Dim tel As Integer
Let tel = 1
Sheets("vragen").Activate
With ActiveSheet
Do While tel < 66
Me.OLEObjects("OptionButton" & tel).Object.value = 0
tel = tel + 1
Loop
End With

However, I think a construction using For Each - Next is better.
Any suggestions?
Thanking you in advance

"Bob Phillips" schreef in bericht
...
me.oleobjects("OptionButton1").object.value=0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Eef Houniet" wrote in message
...
Readers,

Can OptionButtons be set to 0, using something like For each - Next

??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef






  #8   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,593
Default OptionButton. Reset to 0

Dim oOLE As OLEObject

With Worksheets("vragen")
For Each oOLE In .OLEObjects
If TypeName(oOLE.Object) = "OptionButton" Then
oOLE.Object.Value = 0
End If
Next oOLE
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Eef Houniet" wrote in message
...
Bob,

Thank you for answering my question.
Your suggestion works for one OptionButton.

I worked this out as follows (I that there are 66 buttons):

Dim tel As Integer
Let tel = 1
Sheets("vragen").Activate
With ActiveSheet
Do While tel < 66
Me.OLEObjects("OptionButton" & tel).Object.value = 0
tel = tel + 1
Loop
End With

However, I think a construction using For Each - Next is better.
Any suggestions?
Thanking you in advance

"Bob Phillips" schreef in bericht
...
me.oleobjects("OptionButton1").object.value=0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Eef Houniet" wrote in message
...
Readers,

Can OptionButtons be set to 0, using something like For each - Next

??

Up till now I know no better way then

Me.OptionButton1 = 0
Me.OptionButton2 = 0
Me.OptionButton3 = 0
Me.OptionButton4 = 0

Thanks,
Eef








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 fill and font colors won't reset to default ladypickers Excel Discussion (Misc queries) 1 May 14th 06 04:40 AM
reset information sunderland27 Excel Discussion (Misc queries) 1 April 17th 06 03:42 PM
Autofilter reset button Cheese Excel Discussion (Misc queries) 6 July 9th 05 06:39 PM
Reset Button in Excel? Jan C. Excel Worksheet Functions 3 July 2nd 05 02:08 AM
How Do I Tab From An OptionButton To A TextBox Minitman Excel Discussion (Misc queries) 0 February 23rd 05 09:34 PM


All times are GMT +1. The time now is 05:25 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"