Nauticus66
New Member
- Joined
- Jun 13, 2018
- Messages
- 2
Hi Guys,
First time on the site.
We found the following code online:
We tried to adapt this to be a macro to be enable on a hotkey:
Unfortunately this doesn't work when multiple cells across columns/rows are selected like the first one.
When I tried to ammend it to be selection.entirerow, it threw up an object error.
Can anyone help me resolve this please?
Thanks, Nauticus66
First time on the site.
We found the following code online:
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 the cells
Cells.Font.ColorIndex = 0
With Target
' Highlight the entire row and column that contain the active cell
.EntireRow.Font.ColorIndex = 3
.EntireColumn.Font.ColorIndex = 5
End With
Application.ScreenUpdating = True
End Sub
We tried to adapt this to be a macro to be enable on a hotkey:
Code:
Public Sub Highlight() Application.ScreenUpdating = False
' Clear the color of all the cells
ActiveSheet.Cells.Font.ColorIndex = 0
With ActiveCell
' Highlight the entire row and column that contain the active cell
.EntireRow.Font.ColorIndex = 3
.EntireColumn.Font.ColorIndex = 5
End With
Application.ScreenUpdating = True
End Sub
Unfortunately this doesn't work when multiple cells across columns/rows are selected like the first one.
When I tried to ammend it to be selection.entirerow, it threw up an object error.
Can anyone help me resolve this please?
Thanks, Nauticus66