Expand/Collapse columns on password protected worksheets

Dalex

Board Regular
Joined
Apr 25, 2003
Messages
81
Is there a way to password protect a document AND still allow for a user to expand or collapse columns?

Currently, it appear that when a worksheet is password protected, one cannot expand or collapse a column.

Thank you,

Dalex.
 

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
Thanks for response. I don't want to change the size of the columns, I just want to be able to click on the "plus" sign to expand them out. This doesn't change the column width..does it?

Also, I am currently on XP.

Thanks
 
Upvote 0
Right, I thought XP had that option in the protection, but not...

Ok then, let's use the same trick that works to enable the autofilter in previous versions. Put this in the Workbook module, and change the sheet (And password if you need to)

<font face=Courier New>
<SPAN style="color:darkblue">Private</SPAN> <SPAN style="color:darkblue">Sub</SPAN> Workbook_Open()
    <SPAN style="color:darkblue">With</SPAN> Sheets("Sheet1")
        .Protect "password", , , , <SPAN style="color:darkblue">True</SPAN>
        .EnableOutlining = <SPAN style="color:darkblue">True</SPAN>
    <SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">With</SPAN>
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN>
</FONT>
 
Upvote 0
Thanks,I'll give it a shot and let you know. I'm sort of new to entering code so if you can give me more baby steps I would be very thankful. :)

Dalex
 
Upvote 0
Hello,

I typed in the formula in "This workbook" as you suggested, but it did not expand as expected. Please note that I am looking to expand rows and columns. Does this change the code? Also, am I to fill in the ", , , " part of the code with something?

Thank you

Dalex
 
Upvote 0
I've entered the code but am not getting the desired reults. Any additional thoughts.

Perhaps I'm not entering the code correctly.

FYI - I'm looking to do this to a worksheet and not a workbook.
 
Upvote 0
Ok, follow me on this steps.

Open Excel
Open the workbook that you want
Right click the little workbook icon that is on the LEFT of the File menu
Choose "View code" in there.
Paste the entire code that I gave you, just as it is.

The ONLY thing that you may need to change is the "Sheet1" with the name of the sheet that you want, and "password" with the password that you're using to protect the sheet.

After that, go back to Excel, save the workbook, close it, and open it again.
 
Upvote 0
It worked. Thank you. I guess I needed some hand holding.

Thank you, this capability makes my project great! You have helped metremendously!

Dalex
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,447
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top