lock a cell with specifications

chandsu

New Member
Joined
Mar 19, 2010
Messages
39
I want to lock a cell which has date in row column, it should be not editable on the row, if the date is in past date and only the present date & Future date row should be editable.

If the A1 row date 07-Mar-2018 - the entire row should not be eidtable and it should editable with a password lock by only one user

I hope you understand my query, please free to reply for the query.

Looking forward for reply on the same.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
you cant password a cell, you protect the entire sheet.

If I understand correctly, you only want 1 user to have the password to the sheet,(like a manager)
all other persons CAN edit now & future dates, but when they alter a date to a past date, you want THAT cell protected,
even tho the user does NOT know the password.

The password will have to be stored in the code, the users make changes, then the code will check every record for that 1 column date, then lock it.
Is this correct?
what column?
 
Last edited:
Upvote 0
you cant password a cell, you protect the entire sheet.

If I understand correctly, you only want 1 user to have the password to the sheet,(like a manager)
all other persons CAN edit now & future dates, but when they alter a date to a past date, you want THAT cell protected,
even tho the user does NOT know the password.

The password will have to be stored in the code, the users make changes, then the code will check every record for that 1 column date, then lock it.
Is this correct?
what column?


Thanks for the reply,

It is report, where every user enter there daily productivity data on a daily basis. Sometime user enter extra volume for the past date and which make confusion at the end of month.
What i need is user who enter the data today the user should not be amend the next day or in future of the data which is enter on the previous day or past date data.

Only Manager should have access to amend past date data on the report, which he should have access to amend the past date data. where user should have only access to today's date row or column.

i hope you have understand what i am requesting if you have any further query i am happy to talk with you or explain my query.
 
Upvote 0
I agree with what ranman256 said, you cannot lock a cell. You can lock an entire sheet and then unlock areas

Another suggestion I have is taken from some changed I helped CaWingz with here. There requirement was to unlock a column on a date.
Changing the code slightly (below) will allow you to have a row editable if the date is today or in the future.

However this is not a great 'security' and if you wanted to lock users out, then I would recommend locking the whole sheet and only unlocking ranges/cells that match your requirements, an example by VoG is here


*Edit* Added a quick username option so your manager will not be affected by this code:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Environ$("UserName") = "Your.managername" Then Exit Sub
If Cells(Selection.Row, 1).Value >= Date Then

ActiveSheet.Unprotect Password:="111111"
ActiveSheet.EnableSelection = xlNoRestrictions

ElseIf Cells(Selection.Row, 1).Value < Date Then
ActiveSheet.Protect Password:="111111"

End If

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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