Protecting Cetain Cells in Excel

C

CharlieS

I have a spreadsheet that we will be sending out to many users. It will have
several columns protected and one unprotected so that the users can enter a
Yes or no to that column. I want to know if I can have that cell protected
once the entry is made or do I need to go back and lock that cell
individually? I have 44,000 rows we will be working with and it could get
very tedious to have to relock each one at the end of the day... HELP!
 
P

Paul B

CharlieS, you can with a macro,

Private Sub Worksheet_Change(ByVal Target As Range)
'Automatically Protecting After Input
'unlock all cells in the range first
Dim MyRange As Range
Const Password = "123" '**Change password here**
Set MyRange = Intersect(Range("A:A"), Target) '**change range here**

If Not MyRange Is Nothing Then
Unprotect Password:=Password
MyRange.Locked = True
Protect Password:=Password
End If

End Sub



To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
C

CharlieS

Thanks! That's a huge help! I was really worried about having to go through
all 44 thousand entries each night so you just saved me a huge amount of work
and headache!
 
P

Paul B

Your welcome
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
C

CharlieS

Next question - do you know if I can protect the spreadsheet from being
printed? Also can I protect it from being copied? I am not sure what they
are up to, but these are the tasks I am being asked to accomplish... Thanks.
 
P

Paul B

CharlieS,
Not really, I think anything that you do can be bypassed if someone wants to

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Top