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

C

cyberarmao

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.
 
N

Norman Jones

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
'<<=============
 
C

cyberarmao

cyberarmao said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top