How to Set Focus a row - Option Button Click

L

Lisab

How to Set Focus to the row - Option Button Click

***My Problem***
when you click on an Option Button it does not change the focus or make the
Option Button cell the active cell.

in my worksheet I have a Option Button in every row that will run a macro
that uses the values from the cells in the active row

I would like to set the focus or make the row from where the Button is
pressed, the active row

***example ***
If I click on a cell in row 3 then click on the option button in row 5 the
code that runs uses the values from row 3 - because clicking on the Option
Button does not change the focus off of row 3 and onto row 5

When I click on the option button in row 5, I want to make row 5 the active
row so the macro will use the values in row 5

does anyone have any ideas on how to change the focus when an Option Button
is clicked?
 
J

Joel

You need to change the LinkCell property of the Option button.

On excel spreadsheet Menu - View - toolbar - Control Toolbar. Enter design
mode (triangle). Then press conhtrol button and select properties on the
toolbar. Chenge LinkCell to any cell.

Then double click option button to open a VBA macro. Add code below. Each
button will have its own macro.

Private Sub OptionButton1_Click()
linkcell = OptionButton1.LinkedCell
Range(linkcell).Select
End Sub
 
L

Lisab

I used the Option button from the Forms toolbox

When I look at the Command Button from the Control Toolbar I do not see the
LinkCell Property in the property window. However, there is a
TakeFocusOnClick property.

I am going to change my option butttons to command buttons and see if that
works.
 

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