I have a worksheet with some buttons to Hide and Unhide various columns. Everything in my current sheet works fine, but I was trying to find out if there is a way to speed it up some (there is currently a slight delay (not a major problem).
Example of 3 button codes:
Private Sub CommandButton1_Click()
'This is for 1-3 Vendors
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="test"
Range("O:AP,AR:XFD").EntireColumn.Hidden = True
ActiveSheet.Protect Password:="test", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
'This is for 4 Vendors
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="test"
Range("A:R").EntireColumn.Hidden = False
Range("S:AP,AR:XFD").EntireColumn.Hidden = True
ActiveSheet.Protect Password:="test", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton3_Click()
'This is for 5 Vendors
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="test"
Range("A:V").EntireColumn.Hidden = False
Range("W:AP,AR:XFD").EntireColumn.Hidden = True
ActiveSheet.Protect Password:="test", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
Thanks.
Bookmarks