Hi Everyone,
Below is a great little piece of code that I came across (source unknown - sorry!)...
It works great but I've encountered a problem under certain conditions:
1- When I Save & Re-Open the file.
2- Switching from Excel to Firefox and back to Excel (Excel file still running).
This causes the VB code tp highlights the new intersection but doesn't "clear the original" intersection?
I've tried adding something like:
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select
But obviously won't work, any ideas???
*** ACTUAL CODE *** Added to every Worksheet of my File ***
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Highlight Cell Intersection (Column/Row)
'Note: All other Background Colour Formats will be lost
Static LastChange
Application.ScreenUpdating = False
If LastChange = Empty Then
LastChange = ActiveCell.Address
End If
Range(LastChange).EntireColumn.Interior.ColorIndex = xlNone
Range(LastChange).EntireRow.Interior.ColorIndex = xlNone
ActiveCell.EntireColumn.Interior.ColorIndex = 43
ActiveCell.EntireRow.Interior.ColorIndex = 43
LastChange = ActiveCell.Address
Application.ScreenUpdating = True
End Sub
Below is a great little piece of code that I came across (source unknown - sorry!)...
It works great but I've encountered a problem under certain conditions:
1- When I Save & Re-Open the file.
2- Switching from Excel to Firefox and back to Excel (Excel file still running).
This causes the VB code tp highlights the new intersection but doesn't "clear the original" intersection?
I've tried adding something like:
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select
But obviously won't work, any ideas???
*** ACTUAL CODE *** Added to every Worksheet of my File ***
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Highlight Cell Intersection (Column/Row)
'Note: All other Background Colour Formats will be lost
Static LastChange
Application.ScreenUpdating = False
If LastChange = Empty Then
LastChange = ActiveCell.Address
End If
Range(LastChange).EntireColumn.Interior.ColorIndex = xlNone
Range(LastChange).EntireRow.Interior.ColorIndex = xlNone
ActiveCell.EntireColumn.Interior.ColorIndex = 43
ActiveCell.EntireRow.Interior.ColorIndex = 43
LastChange = ActiveCell.Address
Application.ScreenUpdating = True
End Sub