Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to count optionbuttons on specific range on worksheet
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to count optionbuttons on specific range on worksheet
A suggested enhancement to Norman's idea
Dim rng1 as Range For Each OP In ActiveSheet.OptionButtons set rng1 = Range(OP.TopLeftCell,OP.BottomRightCell) If Not Intersect(rng1, rng) Is Nothing Then Depends on what you consider to be within that range. -- Regards, Tom Ogilvy "Norman Jones" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to count optionbuttons on specific range on worksheet
Hi Tom,
A suggested enhancement to Norman's idea set rng1 = Range(OP.TopLeftCell,OP.BottomRightCell) Depends on what you consider to be within that range. A distinct enhancement - and I like it! --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
COUNT BETWEEN A SPECIFIC DATE RANGE | Excel Discussion (Misc queries) | |||
Count Specific word in Specific range | Excel Programming | |||
Count Specific word in specific range | Excel Worksheet Functions | |||
Count If Specific word in specific range | Excel Discussion (Misc queries) | |||
Count used cells, in a specific range... | Excel Programming |