ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding/Unhiding protected columns (https://www.excelbanter.com/excel-programming/375817-hiding-unhiding-protected-columns.html)

Meltad

Hiding/Unhiding protected columns
 
I have a protected worksheet but still need users to be able to hide/unhide
columns to customise their views and prints - how can I do this? I found the
following code posted in this discussion board but this doesn't allow me to
hide/unhide even when I run it every time the workbook is opened.... Any
ideas?

Option Explicit
Sub RUN_ME_EVERY_TIME_YOU_OPEN()
With Worksheets("Report")
.Protect Password:="bsd", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub

Dave Peterson

Hiding/Unhiding protected columns
 
If you're using View|Custom View, then I don't think that this code will help
you.

But if you've just applied Data|Group|Group and outline, then it may do what you
want...

But this code won't help unless you run it.

Do you call it with another procedure? Do you have a button that the user
clicks to run it?

Or did you want it to run automatically when the workbook is opened?

If you want it automatic, make sure that the code is in a General module (not
behind ThisWorkbook and not behind a worksheet) and rename it to:

Sub Auto_Open()
instead of:
Sub RUN_ME_EVERY_TIME_YOU_OPEN()

Macros will have to be enabled, though.


Meltad wrote:

I have a protected worksheet but still need users to be able to hide/unhide
columns to customise their views and prints - how can I do this? I found the
following code posted in this discussion board but this doesn't allow me to
hide/unhide even when I run it every time the workbook is opened.... Any
ideas?

Option Explicit
Sub RUN_ME_EVERY_TIME_YOU_OPEN()
With Worksheets("Report")
.Protect Password:="bsd", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub


--

Dave Peterson


All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com