Forum Discussion
change the display of the active cell
Hi ardiaz0124 ,
It is possible to this by using VBA. In VBA editor, you first have to (1) select the sheet that you want to apply this highlights, (2) change the object to "Worksheet" and (3) change the procedure to "SelectionChange":
After, you can paste the following code (extracted from Microsoft Documentation, at this https://learn.microsoft.com/en-us/office/vba/excel/concepts/cells-and-ranges/highlight-the-active-cell-row-or-column) inside the Private Sub Worksheet_SelectionChange:
' Clear the color of all the cells
Cells.Interior.ColorIndex = 0
If IsEmpty(Target) Or Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
With ActiveCell
' Highlight the row and column that contain the active cell, within the current region
Range(Cells(.Row, .CurrentRegion.Column), Cells(.Row, .CurrentRegion.Columns.Count + .CurrentRegion.Column - 1)).Interior.ColorIndex = 4
Range(Cells(.CurrentRegion.Row, .Column), Cells(.CurrentRegion.Rows.Count + .CurrentRegion.Row - 1, .Column)).Interior.ColorIndex = 4
End With
Application.ScreenUpdating = True
The result will be the following, and the highlighted row/column will change according to the cell that you click:
You can change the color of the highlight by changing the numbers of "Interior.ColorIndex" in lines 7 and 8.
Note that:
1. This highlight won't work if you have more than one cell in the same selection;
2. You will have to apply this same piece of code to all of the Sheets that you need.
Let me know if you need any additional help with this problem.