View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default How to count optionbuttons on specific range on worksheet

Hi Sam,

Try:

'=============
Public Sub Tester()
Dim rng As Range
Dim OP As OptionButton
Dim iCtr As Long

Set rng = Range("D1:F15")
For Each OP In ActiveSheet.OptionButtons
If Not Intersect(OP.TopLeftCell, rng) Is Nothing Then
iCtr = iCtr + 1
End If
Next OP

MsgBox iCtr

End Sub
'<<=============


--
---
Regards,
Norman



"sam" wrote in message
oups.com...
HI,

I know the method to count the option buttons(From form toolbar) on one
worksheet as follow:

Worksheets("Sheet 1").OptionButtons.Count

Now, I want to count option buttons on specific range on worksheet,
like range"D10:F15"

I used the following code:

Worksheets("Sheet 1").range("D10:F15").OptionButtons.Count

However, it doesn't work.

Do you have some ideas about this issue? which clause should I use?
Thank you inadvance!!!


Best Regards

Sam