Protect/lock a few cells but allow column resize

Tron57

Board Regular
Joined
Sep 26, 2002
Messages
66
is it possible to lock a group of cells but still allow column resizing or hide/unhide. The column may or may not be part of the locked cells.

And if it is possible how would I pull this off in VBA. Or even non-VBA for that matter.

thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
after posting i searched to board to see if this is possbile and i dont even see it asked... :eek: kinda bumping this to the top. one of you excel masters must know this. :biggrin:
 
Upvote 0
in VBA help type "Protect Method"

you can set up a cell to be locked only to prevent it's contents from being changed. this would allow resizing and what not. to do so use this snippet of code:

expression.Protect "Password", DrawingObjects:=False, Contents:=True, Scenarios:=False, UserInterfaceOnly:=False

then you can lock whichever cells you want locked and then the worksheet will protect only their contents.

Let me know if this helps :)
 
Upvote 0
thanks for the reply...
well that answer is on the right path... i knew how to do that much... but the problem im facing is when i lock the worksheet i am unable to resize columns.
is there a way to protect the contents of a cell but allow column resize?
 
Upvote 0
If using VBA, in order to resize the columns when you have protected the worksheet, you need arguments to the protect code that specifies this as shown below for example:

ActiveSheet.Protect AllowFormattingColumns:=True
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,391
Members
449,080
Latest member
Armadillos

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