![]() |
Change Cell colour on click
I have 4 cells in a row A1, A2, A3, A4
Is there a way to change the colour of a cell just by clicking in it? (eg) A1=Blue, A2=Green, A3=Orange, A4= Red The other 3 cells are to be reset to blank. Excel 2003, SP3 A big thank you to whoever knows the answer. Cheers George |
Change Cell colour on click
You have two solutions in your other post on 10/20 @ 10:56PM
I tried them, both work as you requested. If you cannot view your past post for some reason, post back here and I or someone can post the solutions from there to here for you... HTH Regards, Howard "goneil" wrote in message ... I have 4 cells in a row A1, A2, A3, A4 Is there a way to change the colour of a cell just by clicking in it? (eg) A1=Blue, A2=Green, A3=Orange, A4= Red The other 3 cells are to be reset to blank. Excel 2003, SP3 A big thank you to whoever knows the answer. Cheers George |
Change Cell colour on click
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: I have 4 cells in a row A1, A2, A3, A4 Is there a way to change the colour of a cell just by clicking in it? (eg) A1=Blue, A2=Green, A3=Orange, A4= Red The other 3 cells are to be reset to blank. Excel 2003, SP3 A big thank you to whoever knows the answer. Cheers George |
All times are GMT +1. The time now is 02:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com