Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
test for click in cell
Dear Excel community,
I have put a border around cells A1, A2, A3, A4. Just by clicking in a cell I would like "just" that cell to go: A1 to go Red, A2 Green, A3 Amber, A4 Blue. When I click in a cell set the other 3 cells to blank Thank you to the bright spark that can figure this out. Cheers George |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
test for click in cell
Hi
Try the following Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim rng As Range, tr As Long Set rng = Range("A1:A4") If Not Intersect(Target, rng) Is Nothing Then tr = Target.Row rng.Interior.ColorIndex = xlNone Select Case tr Case 1 Target.Interior.ColorIndex = 3 Case 2 Target.Interior.ColorIndex = 4 Case 3 Target.Interior.ColorIndex = 44 Case 4 Target.Interior.ColorIndex = 41 Case Else End Select End If End Sub -- Regards Roger Govier "goneil" wrote in message ... Dear Excel community, I have put a border around cells A1, A2, A3, A4. Just by clicking in a cell I would like "just" that cell to go: A1 to go Red, A2 Green, A3 Amber, A4 Blue. When I click in a cell set the other 3 cells to blank Thank you to the bright spark that can figure this out. Cheers George __________ Information from ESET Smart Security, version of virus signature database 4527 (20091020) __________ The message was checked by ESET Smart Security. http://www.eset.com __________ Information from ESET Smart Security, version of virus signature database 4527 (20091020) __________ The message was checked by ESET Smart Security. http://www.eset.com |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
test for click in cell
First install the following macro in a standard module and run it:
Sub Macro1() ActiveSheet.Hyperlinks.Add Anchor:=Range("A1"), Address:="", SubAddress:= _ "Sheet1!A1", TextToDisplay:=" " ActiveSheet.Hyperlinks.Add Anchor:=Range("A2"), Address:="", SubAddress:= _ "Sheet1!A2", TextToDisplay:=" " ActiveSheet.Hyperlinks.Add Anchor:=Range("A3"), Address:="", SubAddress:= _ "Sheet1!A3", TextToDisplay:=" " ActiveSheet.Hyperlinks.Add Anchor:=Range("A4"), Address:="", SubAddress:= _ "Sheet1!A4", TextToDisplay:=" " End Sub This just sets up some hyperlinks in A1 thru A4 Then install the following worksheet event macro in the worksheet code area: Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) i = Right(Target.Parent.Address, 1) Dim r As Range, r2 As Range Set r2 = Range(Target.Parent.Address) Set r = Range("A1:A4") r.Interior.ColorIndex = xlNone red = 3 green = 10 yellow = 6 blue = 5 With r2.Interior If i = 1 Then .ColorIndex = red If i = 2 Then .ColorIndex = green If i = 3 Then .ColorIndex = yellow If i = 4 Then .ColorIndex = blue End With End Sub -- Gary''s Student - gsnu200908 "goneil" wrote: Dear Excel community, I have put a border around cells A1, A2, A3, A4. Just by clicking in a cell I would like "just" that cell to go: A1 to go Red, A2 Green, A3 Amber, A4 Blue. When I click in a cell set the other 3 cells to blank Thank you to the bright spark that can figure this out. Cheers George |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Test if CELL is in RANGE | Excel Worksheet Functions | |||
Calculate mean of test scores from rows of test answers | Excel Discussion (Misc queries) | |||
How can i test a cell for bold style in a cell (Excel 2003)? | Excel Worksheet Functions | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Click on cell-calendar drops down-click on date-date fills cell. . | Setting up and Configuration of Excel |