ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How get a row number of the controls(sample:optionbutton) (https://www.excelbanter.com/excel-programming/363283-how-get-row-number-controls-sample-optionbutton.html)

cyberarmao

How get a row number of the controls(sample:optionbutton)
 
I create a sheet , add some controls at the cells,
Sample: at cell(10,1), add a optionbutton, when click the button, I will
write some text at cell(10,3)......

I can get the controls' x/y-ray, but the 1-9 row height are not same, so
cant calculate the row number by the way.

Pls help me, thank you.


Norman Jones

How get a row number of the controls(sample:optionbutton)
 
Hi Cyberarmao,

Is this a control from the Forms toolbar?

Try:

'=============
Public Sub Tester()
Dim OpTopLeft As String

OpTopLeft = ActiveSheet.OptionButtons _
("Option Button 2").TopLeftCell.Address(0, 0)

MsgBox OpTopLeft

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

---
Regards,
Norman


"cyberarmao" wrote in message
...
I create a sheet , add some controls at the cells,
Sample: at cell(10,1), add a optionbutton, when click the button, I will
write some text at cell(10,3)......

I can get the controls' x/y-ray, but the 1-9 row height are not same, so
cant calculate the row number by the way.

Pls help me, thank you.




cyberarmao

How get a row number of the controls(sample:optionbutton)
 


"cyberarmao" wrote:

I create a sheet , add some controls at the cells,
Sample: at cell(10,1), add a optionbutton, when click the button, I will
write some text at cell(10,3)......

I can get the controls' x/y-ray, but the 1-9 row height are not same, so
cant calculate the row number by the way.

Pls help me, thank you.

my code is :
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
Worksheets("Test").Range("F8").Value = "No Title"
End Sub

I want to calculate the row number of OptionButton2.



All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com