SRMPURCHASE
Board Regular
- Joined
- Dec 23, 2014
- Messages
- 206
- Office Version
-
- 2016
- Platform
-
- Windows
I would like to modify the following VBA to only highlight to the left and up from the active cell, can anyone help?
I like this solution as it involves no conditional formatting to perform.
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cr
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
rr = Selection.Row
cc = Selection.Column
With Columns(cc).Interior
.ColorIndex = 8
.Pattern = xlSolid
End With
With Rows(rr).Interior
.ColorIndex = 8
.Pattern = xlSolid
End With
End Sub
I like this solution as it involves no conditional formatting to perform.
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cr
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
rr = Selection.Row
cc = Selection.Column
With Columns(cc).Interior
.ColorIndex = 8
.Pattern = xlSolid
End With
With Rows(rr).Interior
.ColorIndex = 8
.Pattern = xlSolid
End With
End Sub