I have a code that checks to see if there is a change in Column C, and then autofits columns C:U, then hides a specific column. However, the code is not doing anything now. No errors occur, nothing happens to the sheet, and if there too many characters in a cell, the ### is all I see, which is what this code is designed to stop. What have I done wrong?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If Target.Column = 3 Then
ActiveSheet.Unprotect
Columns("C:U").AutoFit
Columns("T").Hidden = True
ActiveSheet.Protect
Else
Exit Sub
End If
Application.ScreenUpdating = True
End Sub
Last edited: