Protecting specific columns from resizing

Binbs

New Member
Joined
Jan 7, 2022
Messages
33
Office Version
  1. 365
Platform
  1. Windows
Hello,

I would like to restrict users from resizing specific columns in my worksheet and allow them to resize or hide the others.

I've followed the steps to first unlock all cells by selecting the entire worksheet then format, unlocking in the Protection tab. Then I select the two columns I want to protect and lock those ones in the Protection tab.

However, when I protect the worksheet, it prevents resizing all of the unlocked columns as well, not just the ones that I locked.

I'm not sure where I've gone wrong. I see posts about locking and protecting specific cells but not this specific problem.

Thanks for any help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
If it is a macro-enabled workbook, another option is to use VBA to enforce a specific column width of the columns you choose. In other words, the user might change it, but then your VBA code changes it back. Either immediately or at an event you choose (such as the worksheet_deactivate event).
 
Upvote 0
Solution
If it is a macro-enabled workbook, another option is to use VBA to enforce a specific column width of the columns you choose. In other words, the user might change it, but then your VBA code changes it back. Either immediately or at an event you choose (such as the worksheet_deactivate event).
So great! Thank you. I will look into this.
 
Upvote 0
I found this code which works for resizing the column when I run it.

VBA Code:
Sub Set_Column_Range_Width()

Dim MySheet As Worksheet

Set MySheet = ActiveSheet


With MySheet.Columns("C")
 .ColumnWidth = 52.27
End With
End Sub

Is there a way I can trigger this to run if the column is resized?
 
Upvote 0
Why don't you just lock the spreadsheet to keep this from happening.
 
Upvote 0
Why don't you just lock the spreadsheet to keep t
Thanks for the suggestion. That's exactly what I was trying to do initially but wasn't able to prevent resizing of specific columns (read above).
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,844
Members
449,051
Latest member
excelquestion515

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