Sure, but with one caveat: this will wipe out all conditional formatting instead.
This code uses the same logic, but instead applie temporary Conditional Formatting to the row and column which has the benefit of not overwriting normal cell formatting.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rowNumberValue As Integer, columnNumberValue As Integer, i As Integer, j As Integer
Cells.FormatConditions.Delete
rowNumberValue = ActiveCell.Row
columnNumberValue = ActiveCell.Column
For i = 1 To rowNumberValue - 1
With Cells(i, columnNumberValue)
.FormatConditions.Add Type:=xlExpression, Formula1:="=(1=1)"
.FormatConditions(1).Interior.Color = 5296274
End With
Next i
For j = 1 To columnNumberValue - 1
With Cells(rowNumberValue, j)
.FormatConditions.Add Type:=xlExpression, Formula1:="=(1=1)"
.FormatConditions(1).Interior.Color = 5296274
End With
Next j
End Sub
Bookmarks