I have recorded 3 macros in my workbook to unprotect a worksheet, unhide either 5, 10, 15 columns (depending on the shortcut key used). It works fine on 2 of the worksheets but on the third worksheet it only unhids the last 5 columns.
My macros are shown below
Column5 Macro
'
' Keyboard Shortcut: Ctrl+Shift+A
'
ActiveSheet.Unprotect
Columns("K:O").Select
Selection.Columns("K:O").Hidden = False
ActiveSheet.Protect
End Sub
Sub Columns10()
'
' Columns10 Macro
'
' Keyboard Shortcut: Ctrl+Shift+S
'
ActiveSheet.Unprotect
Columns("K:T").Select
Selection.Columns("K:T").Hidden = False
ActiveSheet.Protect
End Sub
Sub Column15D()
'
' Column15 Macro
'
' Keyboard Shortcut: Ctrl+Shift+D
'
ActiveSheet.Unprotect
Columns("K:Y").Select
Selection.Columns("K:Y").Hidden = False
ActiveSheet.Protect
End Sub
Any idea what is wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have recorded 3 macros in my workbook to unprotect a worksheet, unhide either 5, 10, 15 columns (depending on the shortcut key used). It works fine on 2 of the worksheets but on the third worksheet it only unhids the last 5 columns.
My macros are shown below
Column5 Macro
'
' Keyboard Shortcut: Ctrl+Shift+A
'
ActiveSheet.Unprotect
Columns("K:O").Select
Selection.Columns("K:O").Hidden = False
ActiveSheet.Protect
End Sub
Sub Columns10()
'
' Columns10 Macro
'
' Keyboard Shortcut: Ctrl+Shift+S
'
ActiveSheet.Unprotect
Columns("K:T").Select
Selection.Columns("K:T").Hidden = False
ActiveSheet.Protect
End Sub
Sub Column15D()
'
' Column15 Macro
'
' Keyboard Shortcut: Ctrl+Shift+D
'
ActiveSheet.Unprotect
Columns("K:Y").Select
Selection.Columns("K:Y").Hidden = False
ActiveSheet.Protect
End Sub
Any idea what is wrong?