disallow edit in a cell with data

  • Thread starter Thread starter prkhan56
  • Start date Start date
P

prkhan56

Hello All,
I use Office 2003.
I have a worksheet where I want to prevent users from changing data
once it is
entered in a blank cell.
Is it possible with a macro where it should
1) save the worksheet once data is entered
2) ask for a password if someone tries to edit a cell with an entry in
it.

Thanks in advance.

Rashid Khan
 
First "Unlock" all cells on the sheet
Select all cells, the little square that intersects row/col headers
Format, Cells, Protection, Locked - uncheck

Rt-Click the sheet tab, view-code to open the worksheet module and paste in
the following

Private Sub Worksheet_Change(ByVal Target As Range)

Me.Unprotect "abc"
Target.Locked = True
Me.Protect Password:="abc", Contents:=True

End Sub

You could ignore the password entirely, depending on what user is allowed to
access to.

So what happens if user makes a mistake when entering the data ???

Regards,
Peter T
 
First "Unlock" all cells on the sheet
Select all cells, the little square that intersects row/col headers
Format, Cells, Protection, Locked - uncheck

Rt-Click the sheet tab, view-code to open the worksheet module and paste in
the following

Private Sub Worksheet_Change(ByVal Target As Range)

    Me.Unprotect "abc"
    Target.Locked = True
    Me.Protect Password:="abc", Contents:=True

End Sub

You could ignore the password entirely, depending on what user is allowedto
access to.

So what happens if user makes a mistake when entering the data ???

Regards,
Peter T








- Show quoted text -

Thanks for your help. Editing is not allowed if someone makes a
mistake, he/she should contact the admin for help.

Can it prop up a message box saying to contact the admin for the
password/help?

Regards
Rashid Khan
 
Thanks for your help. Editing is not allowed if someone makes
a mistake, he/she should contact the admin for help.

OK, so the code I suggested should work for your purposes. Maybe start by
only "unlocking" cells user can enter data once only. Did you try the
sugegstion.
Can it prop up a message box saying to contact the
admin for the password/help?

Probably, but in what scenario, your question is not clear.

Regards
Rashid Khan
 
OK, so the code I suggested should work for your purposes. Maybe start by
only "unlocking" cells user can enter data once only. Did you try the
sugegstion.


Probably, but in what scenario, your question is not clear.

RegardsRashidKhan

Sorry my system was down.
Actually the solution you provided works but mine is a shared workbook
and it does not work with shared workbook
However, if a msg box can prop up when the user tries to edit the
cell.

Thanks

Rashid Khan
 
I don't have experience of shared workbooks and cannot test what works or
not. Maybe if there is someway to update changes in both users the original
suggestion will work.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top