May 27 2023 12:01 PM - edited May 27 2023 12:47 PM
Hello everyone I hope you are well.
Just a small request, I have the file shown above and I would like to highlight the column header of the selected cell
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, Scenarios:=False
ActiveSheet.EnableSelection = xlNoRestrictions
If Sh.Name = "6" Then Exit Sub
If Not Application.Intersect(Target, Range("C3:AM45")) Is Nothing Then
Range("C3:AM45").Interior.ColorIndex = xlColorIndexNone
Columns("C:AM").Interior.ColorIndex = 2
Columns("C:AM").Interior.Color = RGB(255, 255, 255)
Target.EntireRow.Range("C1:AM1").Interior.Color = RGB(255, 228, 181)
Target.Range("C1:AM1").Cells(0, -1).Interior.Color = RGB(255, 255, 0)
Target.Interior.Color = RGB(255, 255, 0)
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoRestrictions
End If
End Sub
Expect
May 27 2023 12:20 PM
SolutionI don't really understand your code, but perhaps add the following line above the line that protects the sheet just before the end of the code:
Sh.Cells(2, Target.Column).Interior.Color = RGB(255, 255, 0)
May 27 2023 12:47 PM
May 27 2023 12:20 PM
SolutionI don't really understand your code, but perhaps add the following line above the line that protects the sheet just before the end of the code:
Sh.Cells(2, Target.Column).Interior.Color = RGB(255, 255, 0)