Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Lock & Protect Cells With Data

Hi Everyone,

I have 6 Users who Input Data ( in a Shared Workbook ) in their OWN
Worksheet. Each Worksheet is Protected ( So they can ONLY Select
Unlocked Cells ) with a Password and ALL Cells are Locked Except for
the Range "C4:H6" ( These are the ONLY Cells in which Data can be
Entered by the User ).
They will Enter Data ( Numeric ) in Cells "C4:C6" for Period 1, they
MUST be Able to Amend the Data if Necessary. When they are Happy with
the Results they will Save the File.
What I would like is that when they Open the File to Input Data for
Period 2 in Cells "D4:D6" they CANNOT Change the Data Already Entered
for Period 1, and the Same for the Rest of the Periods.
Is there a way to "Lock" the Cells that are " " ( Blank OR Empty )
so that they CANNOT be Changed.
There is a Button Called "Finished" that they Click to Hide their
Worksheet Before Saving the File, Perhaps the Code to "Lock" the Cells
could be Added to that.
The Code Behind the Finished Button for Group 1 is :-

Sub Group_1_Finished()

UserName = Sheets("Login & Logoff").Cells(2, 3)
Password = Sheets("Login & Logoff").Cells(3, 3)

If UserName = "Group 1" And Password = "Group 1 Password" Then
Sheets("Group 1").Visible = xlVeryHidden
Range("C3") = ""
Else
Range("C3") = ""
MsgBox "The Group 1 Password You Have Entered Is Invalid, Please Try
Again.", _
vbCritical, "Invalid Group 1 Password"
End If
End Sub

Thanks in Advance
All the Best
Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Lock & Protect Cells With Data

Thanks Fran,

I have Searched High and Low for a Macro to do this.
I know that it Probably Needs to be a Macro for Worksheet_On_Open
Event which will be Placed in the Worksheet Code, or some Code to be
Added to the Code Already Setup for the "Finished" Button.

Thanks Again
All the Best
Paul



"Fran" wrote in message ...
Seems like you should be able to write a macro. If you named a range for the
input cells for Periods 2, 3, 4 etc. and used an IF statement with a "Date
more than" a certain date - then they're locked - if not, they're open. I'm
not all that VBA literate but have written plenty of macros by clicking. You
sound like you're pretty VBA literate.


"Paul Black" wrote:

Hi Everyone,

I have 6 Users who Input Data ( in a Shared Workbook ) in their OWN
Worksheet. Each Worksheet is Protected ( So they can ONLY Select
Unlocked Cells ) with a Password and ALL Cells are Locked Except for
the Range "C4:H6" ( These are the ONLY Cells in which Data can be
Entered by the User ).
They will Enter Data ( Numeric ) in Cells "C4:C6" for Period 1, they
MUST be Able to Amend the Data if Necessary. When they are Happy with
the Results they will Save the File.
What I would like is that when they Open the File to Input Data for
Period 2 in Cells "D4:D6" they CANNOT Change the Data Already Entered
for Period 1, and the Same for the Rest of the Periods.
Is there a way to "Lock" the Cells that are " " ( Blank OR Empty )
so that they CANNOT be Changed.
There is a Button Called "Finished" that they Click to Hide their
Worksheet Before Saving the File, Perhaps the Code to "Lock" the Cells
could be Added to that.
The Code Behind the Finished Button for Group 1 is :-

Sub Group_1_Finished()

UserName = Sheets("Login & Logoff").Cells(2, 3)
Password = Sheets("Login & Logoff").Cells(3, 3)

If UserName = "Group 1" And Password = "Group 1 Password" Then
Sheets("Group 1").Visible = xlVeryHidden
Range("C3") = ""
Else
Range("C3") = ""
MsgBox "The Group 1 Password You Have Entered Is Invalid, Please Try
Again.", _
vbCritical, "Invalid Group 1 Password"
End If
End Sub

Thanks in Advance
All the Best
Paul

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need to lock 5 cells but not protect entire sheet Lock MY Cells Excel Discussion (Misc queries) 2 September 6th 07 07:14 PM
How do I lock unclock cells to protect the data entered? Sandi@hotmail Excel Worksheet Functions 1 March 13th 07 02:46 AM
How do I lock/protect cells so they can't be changed Julie Excel Worksheet Functions 3 November 4th 06 03:49 AM
Protect/Lock Specific Cells srf1030 Excel Discussion (Misc queries) 6 July 6th 05 08:05 PM
Can I use the grouping and lock and protect cells bfisher Excel Discussion (Misc queries) 1 January 11th 05 10:55 PM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"