Lock Columns except some cells

Xirom431

Board Regular
Joined
Dec 2, 2010
Messages
102
Hi,

I have a workbook with all sheets have the same info. I would like to lock and hidden all sheet columns A to Y except cells Range from J5:N51 and P5:X51. Protect all formulas. Thank you for the help in advance with the vba macro.

Thanks,

XR
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

I have a workbook with all sheets have the same info. I would like to lock and hidden all sheet columns A to Y except cells Range from J5:N51 and P5:X51. Protect all formulas. Thank you for the help in advance with the vba macro.

Thanks,

XR
Hello,
Fiirst, you need to format the 2 cell ranges, as "Unlocked".
Then click Review, Protect Sheet, and click the "Select Unlocked Cells" option.

In your VBA code, you can write your code between these 2 statements, and it will lock and unlock the cells so it can perofrm your code.

VBA Code:
Activesheet.Unprotect
Activesheet.Protect
 
Upvote 0
Note that if you turn on the Macro Recorder and record yourself performing these steps manually, you will get most (if not all) the VBA code you need to do this.
 
Upvote 0
Solution
Note that if you turn on the Macro Recorder and record yourself performing these steps manually, you will get most (if not all) the VBA code you need to do this.
Joe,
you are the man, just wanted you to know that :)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

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