ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Option button and Highlighting an area (https://www.excelbanter.com/excel-discussion-misc-queries/114838-option-button-highlighting-area.html)

Steve

Option button and Highlighting an area
 
I would like to select option button A and have "area A" highlighted, and
"area B" darkened, and the when I select option button B have "area A"
Darkened and "area B Highlighted", Any one have any ideas please. Thank you
to all in advance for any help.

Jim Thomlinson

Option button and Highlighting an area
 
Not too sure what you mean by Highlight but here goes nothin... Grab 2 option
buttons from the Control Toolbox (not the forms toolbar) and place then on a
sheet. Right click on the sheet tab and slect view code. Now add the
following code...

Private Sub OptionButton1_Click()
Range("A1:A10").Interior.ColorIndex = 36
Range("B1:B10").Interior.ColorIndex = 0
End Sub

Private Sub OptionButton2_Click()
Range("B1:B10").Interior.ColorIndex = 36
Range("A1:A10").Interior.ColorIndex = 0
End Sub

--
HTH...

Jim Thomlinson


"Steve" wrote:

I would like to select option button A and have "area A" highlighted, and
"area B" darkened, and the when I select option button B have "area A"
Darkened and "area B Highlighted", Any one have any ideas please. Thank you
to all in advance for any help.



All times are GMT +1. The time now is 06:04 AM.

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