Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default date stamp with protected cells problem

Hi,

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

I'd like to protect the (ai37:iv37) cells in which the day and month are
stamped, however, and I don't know how to change the code. They should become
protected after the date stamp is made if the cell below in the ai37:iv37
range was = "Attendance". If that cell then changed to a blank or anything
else, they should be unprotected to allow the user 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 Nothing 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 Sub
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
problem with date stamp and protected cells Invoice Excel Worksheet Functions 1 August 30th 06 11:43 AM
Create a button that will date stamp todays date in a cell Tom Meacham Excel Discussion (Misc queries) 3 January 11th 06 01:08 AM
Date stamp formula results? Tricky problem? mjp Excel Discussion (Misc queries) 0 November 18th 05 04:11 PM
Problem trying to move between cells on a protected worksheet. ayanna Excel Discussion (Misc queries) 0 April 26th 05 09:18 PM
Date/Time Stamp Macro Button Problem jp_m8 Excel Programming 5 August 26th 04 07:33 PM


All times are GMT +1. The time now is 03:30 AM.

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

About Us

"It's about Microsoft Excel"