Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 698
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Click a cell and all related cells are colour highlighted Cat Woman Excel Worksheet Functions 5 May 31st 09 06:37 AM
Change cell colour Min Excel Worksheet Functions 1 March 28th 07 02:56 AM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
changing cell colour on click Nimbus55 Excel Discussion (Misc queries) 3 September 1st 05 01:18 PM
COLOUR CHANGE IS A CELL Mav Excel Discussion (Misc queries) 1 April 23rd 05 11:22 AM


All times are GMT +1. The time now is 07:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"