M
mcastellano
I have found some good solutions to my problem, but not one that fits
the bill exactly.
I'm looking to format the active cell with a yellow background, but I
need to ensure that the cell's format previous to it being active
remains as it was after the cell is no longer active. All the solutions
I have seen remove the background after the cell is no longer active.
So, if I have a cell with a black background (for instance) and I make
it the active cell the cell will have a yellow background. After I
leave that cell, I need it to return to it's previous state - black
background, not none.
I have tried this code...
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object,
ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target
End Sub
....and I think the answer may lie here "OldRange.Interior.ColorIndex =
xlColorIndexNone"
Any help would be greatly appreciated. Thank you in advance!
-M
the bill exactly.
I'm looking to format the active cell with a yellow background, but I
need to ensure that the cell's format previous to it being active
remains as it was after the cell is no longer active. All the solutions
I have seen remove the background after the cell is no longer active.
So, if I have a cell with a black background (for instance) and I make
it the active cell the cell will have a yellow background. After I
leave that cell, I need it to return to it's previous state - black
background, not none.
I have tried this code...
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object,
ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target
End Sub
....and I think the answer may lie here "OldRange.Interior.ColorIndex =
xlColorIndexNone"
Any help would be greatly appreciated. Thank you in advance!
-M