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;
- Aug 14 Mon 2006 20:09
Update Macro: Leave Colour As Before Once Cell is Not Active
close
全站熱搜
留言列表
發表留言