Lock range if date < today

kashyap

Board Regular
Joined
Mar 28, 2009
Messages
173
Hi I need to lock cells in protected and shared workbook if cell value in colA is 2 days less than today

Eg. if A5=today()-2 then it should lock range A5:I5
 
kashyap,

the code is doing nothing because of "on error resume next": the errors are still there, but are not reported anymore.

BUT, it would be good for you to take care of all replies. rorya has already pointed out that you cannot change protection properties. So even if you solve the problem, you will still not have a working solution.

An alternative could be validation, I'm not sure if it suits your needs.

Else you will need code witch watches what you are doing and will UNDO everything which is done within the "locked" cells (wrote locked between " " because they are not really locked)*

best regards,
Erik
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,224,881
Messages
6,181,539
Members
453,054
Latest member
ezzat

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