Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I've got an excel spreadsheet that is shared by many users. The user i suppose to enter their name into a timeslot they prefer for thei monthly health checkup. The problem: How can I protect the cell which users have entered their name into th spreadsheet? I don't want people to replace the names in a timeslot wit their own names. How to achieve that? K -- kwokhon ----------------------------------------------------------------------- kwokhong's Profile: http://www.excelforum.com/member.php...fo&userid=2790 View this thread: http://www.excelforum.com/showthread.php?threadid=47401 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you won't be able to do it this way. What you need to do is have the time and
person saevd to a database or a text file. This would be pretty fast to read/write, so that the chances for a collision would be quite small. Here's a very simple demo Option Explicit Const TimeFile As String = "c:\TimeFile.txt" Sub SaveTime() Dim test As Date test = "10-oct-2005 12:45" If Not_Available(test) Then MsgBox "Timeslot " & test & " Not Available" Else SaveDown test, "JohnDoe" MsgBox test & " saved" End If End Sub Private Function Not_Available(timeslot As Date) As Boolean Dim ff As Long Dim text As String Dim data As Variant ff = FreeFile If Dir(TimeFile) = "" Then Not_Available = False Else Open TimeFile For Input As ff Do Until EOF(ff) Line Input #ff, text data = Split(text, ",") text = data(0) If text = Format$(timeslot, "yyyymmddhhmm") Then Not_Available = True Exit Do End If Loop Close End If End Function Sub SaveDown(timeslot As Date, username As String) Dim ff As Long Dim text As String text = Format$(timeslot, "yyyymmddhhmm") & "," & username ff = FreeFile Open TimeFile For Append As ff Print #ff, text Close End Sub I hard coded a file name. Test will try to save an appointment. This can easily be adapted to get a time/date and user name from the workbook - but this is a demo The program checks whether th etime slot is available by reading the file, then if the slot is available, it writes to the file. I use dthe C drive for the demo, but if you opt for a similar route, you'll need the file on a network folder that the users all have access to etc. HTH "kwokhong" wrote: Hi, I've got an excel spreadsheet that is shared by many users. The user is suppose to enter their name into a timeslot they prefer for their monthly health checkup. The problem: How can I protect the cell which users have entered their name into the spreadsheet? I don't want people to replace the names in a timeslot with their own names. How to achieve that? KH -- kwokhong ------------------------------------------------------------------------ kwokhong's Profile: http://www.excelforum.com/member.php...o&userid=27901 View this thread: http://www.excelforum.com/showthread...hreadid=474013 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Data Protection Best Practice: AKA: Real Sheet Protection | Excel Discussion (Misc queries) | |||
Excel Data Protection- AKA: Sheet/Macro Password Protection | Setting up and Configuration of Excel | |||
Password Protection - paste to unprotected cell locks the cell | Excel Discussion (Misc queries) | |||
Cell Protection vs. Worksheet Protection | Excel Discussion (Misc queries) | |||
Cell Protection | Excel Worksheet Functions |