Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / August 2006

Tip: Looking for answers? Try searching our database.

problem with date stamp and protected cells

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Invoice - 30 Aug 2006 04:38 GMT
Hi,

I'm using the following code for an automated date stamp. Whenever dat
is found cells (AI37:IV37), the two rows above automatically insert th
day number (dd) and month (mmm), and whenever data is deleted from tha
range, the day and month are deleted.

I'd like to protect the (ai37:iv37) cells in which the day and mont
are stamped, however, and I don't know how to change the code. The
should become protected after the date stamp is made if the cell belo
in the ai37:iv37 range was = "Attendance". If that cell then changed t
a blank or anything else, they should be unprotected to allow the use
to edit the date.

I hope this is not too much trouble. Thanks.

Code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("AI37:IV37"), .Cells) Is Nothin
Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(-1, 0).ClearContents
.Offset(-2, 0).ClearContents
Else
With .Offset(-1, 0)
.NumberFormat = "dd"
.Value = Date
End With
With .Offset(-2, 0)
.NumberFormat = "mmm"
.Value = Date
End With
End If
Application.EnableEvents = True
End If
End With
End Su

--
Invoice
Carim - 30 Aug 2006 11:43 GMT
Hi,

Just after   .Value = Date
add  .Locked = True

and do not forget at the end of your code
to add
ActiveSheet.Protect

HTH
Cheers
Carim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.