Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell protection


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Cell protection

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
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
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Password Protection - paste to unprotected cell locks the cell Jimbob Excel Discussion (Misc queries) 7 September 7th 07 06:22 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Cell Protection Liz - HADC Excel Worksheet Functions 2 July 19th 05 08:00 PM


All times are GMT +1. The time now is 09:35 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"