close

Hi therei got this Macro code, which makes the Active cell change colour, but the
problem is that once you move away from that cell it leaves that cell with no
colour. I need it to return the colour the cell was before it became active.

What would i do to this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static OldCell As Range
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Target.Interior.ColorIndex = 8
Set OldCell = Target
End SubAny help gratefully receivedcheers

jb

See

www.mcgimpsey.com/excel/highl...iteRetainColor

In article gt;,
JB2010 gt; wrote:

gt; Hi there
gt;
gt;
gt; i got this Macro code, which makes the Active cell change colour, but the
gt; problem is that once you move away from that cell it leaves that cell with no
gt; colour. I need it to return the colour the cell was before it became active.
gt;
gt; What would i do to this code:
gt;
gt; Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
gt; Static OldCell As Range
gt; If Not OldCell Is Nothing Then
gt; OldCell.Interior.ColorIndex = xlColorIndexNone
gt; End If
gt; Target.Interior.ColorIndex = 8
gt; Set OldCell = Target
gt; End Sub

LEGEND!!!!cheersjb

quot;JE McGimpseyquot; wrote:

gt; See
gt;
gt; www.mcgimpsey.com/excel/highl...iteRetainColor
gt;
gt; In article gt;,
gt; JB2010 gt; wrote:
gt;
gt; gt; Hi there
gt; gt;
gt; gt;
gt; gt; i got this Macro code, which makes the Active cell change colour, but the
gt; gt; problem is that once you move away from that cell it leaves that cell with no
gt; gt; colour. I need it to return the colour the cell was before it became active.
gt; gt;
gt; gt; What would i do to this code:
gt; gt;
gt; gt; Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
gt; gt; Static OldCell As Range
gt; gt; If Not OldCell Is Nothing Then
gt; gt; OldCell.Interior.ColorIndex = xlColorIndexNone
gt; gt; End If
gt; gt; Target.Interior.ColorIndex = 8
gt; gt; Set OldCell = Target
gt; gt; End Sub
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()