VBA Protecting a sheet to prevent unhide column but allow outlining

miless2111s

Active Member
Joined
Feb 10, 2016
Messages
255
I have some code to protect a sheet which prevents the user from un-hiding columns:
Code:
wsh.protect password:="xxx", AllowFormattingCells:=True, userinterfaceonly:=True
however i have also used in other sheets
Code:
wsh.Protect Password:="xxx", AllowFormattingCells:=True, userinterfaceonly:=True, DrawingObjects:=True 
wsh.EnableOutlining = True

I suspect the latter to was to allow the user to open and close outlining and interact with pivot tables etc (this was a while ago so I am not sure)

In the sheets protected by the latter code the users are able to un-hide columns which isn't good.

How do I allow them to interact with pivots and grouped / outlined rows and columns but NOT un-hide columns and rows?

Many thanks

Miles
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
1,768
Outlining is essentially hiding and unhiding columns or rows. So with .EnableOutlining on, they can unhide columns.

Can you move the columns to another sheet? Can you move the columns way over to the right so they can't see them? You could hide formulas that reference them so they have no idea to check in column ZZ.

Just a couple thoughts
 

Watch MrExcel Video

Forum statistics

Threads
1,109,159
Messages
5,527,145
Members
409,749
Latest member
esmarques

This Week's Hot Topics

Top