Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("C:C, F:F, G:G")) Is Nothing Then
ActiveSheet.Unprotect "987654"
ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowFormattingCells:=True, AllowFiltering:=True
Else
ActiveSheet.Unprotect "987654"
ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=False, AllowFormattingCells:=False, AllowFiltering:=True
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("C:C, F:F, G:G")) Is Nothing Then
ActiveSheet.Unprotect "987654"
ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowFormattingCells:=True, AllowFiltering:=True
[color=red]ActiveCell.EntireRow.AutoFit[/color]
Else
ActiveSheet.Unprotect "987654"
ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=False, AllowFormattingCells:=False, AllowFiltering:=True
End If
End Sub