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: www.excelforum.com/member.php...oamp;userid=29962
View this thread: www.excelforum.com/showthread...hreadid=496600Enter this macro:
Sub Macro1()
Dim r As Range
Set r = Range(quot;A1quot;)
If Not Intersect(r, Selection) Is Nothing Then
Range(quot;X1:Z3quot;).Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
End SubIf you select A1 and then run the macro, the other cells will be colored.
--
Gary's Studentquot;Lezhquot; wrote:
gt;
gt; Is there a way I can change the colour of an array of cells depending on
gt; whether a different specified cell in the worksheet has been selected?
gt;
gt; For example, the conditional formula in each cell in the range X1:Z3
gt; would effectively be: 'if A1 is the currently selected cell, turn me
gt; green'.
gt;
gt; Thanks - Lez
gt;
gt;
gt; --
gt; Lezh
gt; ------------------------------------------------------------------------
gt; Lezh's Profile: www.excelforum.com/member.php...oamp;userid=29962
gt; View this thread: www.excelforum.com/showthread...hreadid=496600
gt;
gt;
Create this UDF:
Public Function AktCell() As String
Application.Volatile
AktCell = ActiveCell.Address(False, False)
End Function
Create this event procedu
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Calculate
End Sub
Apply Conditional formatting in the range X1:Z3
formula: =AktCell()=quot;A1quot;
and choose green background!
Regards,
Stefi
?ezh??ezt ?rta:
gt;
gt; Is there a way I can change the colour of an array of cells depending on
gt; whether a different specified cell in the worksheet has been selected?
gt;
gt; For example, the conditional formula in each cell in the range X1:Z3
gt; would effectively be: 'if A1 is the currently selected cell, turn me
gt; green'.
gt;
gt; Thanks - Lez
gt;
gt;
gt; --
gt; Lezh
gt; ------------------------------------------------------------------------
gt; Lezh's Profile: www.excelforum.com/member.php...oamp;userid=29962
gt; View this thread: www.excelforum.com/showthread...hreadid=496600
gt;
gt;
Thanks GS and Stefi for your input. Although my xl experience has been
limited to the commoner formulas up till now (though I recorded a macro
once and it worked!) I'll try your solutions as a cure for the new year
hangover at the weekend - but I think I might just have to read up a
bit on how to enter this stuff!
Much appreciate your help. Thanks again. --
Lezh
------------------------------------------------------------------------
Lezh's Profile: www.excelforum.com/member.php...oamp;userid=29962
View this thread: www.excelforum.com/showthread...hreadid=496600
- Aug 14 Mon 2006 20:09
XL2K
close
全站熱搜
留言列表
發表留言