I am currently using this code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
'Clear the color of all cells
Cells.Interior.ColorIndex = 0
With Target
'Highlight row and column of the selected cell
.EntireRow.Interior.ColorIndex = 6
.EntireColumn.Interior.ColorIndex = 6
End With
Application.ScreenUpdating = True
End Sub
What this does is follow the cursor which ever cell is selected and it will highlight that row and column to make it easy for the user to see which cell is currently selected. However, I am not able to fill certain cells with different colors and it's because this code seems to refresh the colors of the row and column on the fly while I move the selected cell as I navigate throughout the spreadsheet. Because it keeps refreshing, it will make whatever cell I highlight go back to white.
Is there a way to get it to do what this VBA code is meant to do but also let me highlight certain other cells that I choose?
Thanks for the help.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
'Clear the color of all cells
Cells.Interior.ColorIndex = 0
With Target
'Highlight row and column of the selected cell
.EntireRow.Interior.ColorIndex = 6
.EntireColumn.Interior.ColorIndex = 6
End With
Application.ScreenUpdating = True
End Sub
What this does is follow the cursor which ever cell is selected and it will highlight that row and column to make it easy for the user to see which cell is currently selected. However, I am not able to fill certain cells with different colors and it's because this code seems to refresh the colors of the row and column on the fly while I move the selected cell as I navigate throughout the spreadsheet. Because it keeps refreshing, it will make whatever cell I highlight go back to white.
Is there a way to get it to do what this VBA code is meant to do but also let me highlight certain other cells that I choose?
Thanks for the help.