View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default XL2K - Conditional Formatting relative to cell selection

Enter this macro:

Sub Macro1()
Dim r As Range
Set r = Range("A1")
If Not Intersect(r, Selection) Is Nothing Then
Range("X1:Z3").Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
End Sub


If you select A1 and then run the macro, the other cells will be colored.
--
Gary's Student


"Lezh" wrote:


Is there a way I can change the colour of an array of cells depending on
whether a different specified cell in the worksheet has been selected?

For example, the conditional formula in each cell in the range X1:Z3
would effectively be: 'if A1 is the currently selected cell, turn me
green'. :)

Thanks - Lez


--
Lezh
------------------------------------------------------------------------
Lezh's Profile: http://www.excelforum.com/member.php...o&userid=29962
View this thread: http://www.excelforum.com/showthread...hreadid=496600