LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Set Date in Locked Cell

Hi,

I am trying to auto-set the current date in a cell when data is modified in
a corresponding cell.

The cell that the date is being inserted into is locked so it works great
until I protect the sheet. Once the sheet is protected it will no longer
enter the date into the locked cell. How can I modify the code below to allow
it to enter the date even when the cell it is trying to enter it into is
locked?

"Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim R As Long
R = Target.Row

On Error GoTo ErrHandler
Application.EnableEvents = True

If Not Intersect(Range("L2:m20"), Target) Is Nothing Then
Range("L2:M20").Sort Key1:=Range("L2") '<<== CHECK RANGE
End If

If Target.Column < 2 Then Exit Sub
If Target.Row = 1 Then Exit Sub

Target.Offset(0, 2).Value = Date

ErrHandler:
Application.EnableEvents = True
End Sub


"

Thanks,

Ben
 
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
Locked Cell - can still edit philcud Excel Worksheet Functions 2 October 27th 06 04:28 PM
Formula in Cell changes even if it's locked word 2003 help Excel Discussion (Misc queries) 3 May 19th 06 08:43 PM
run a macro in a locked cell Ray Excel Discussion (Misc queries) 8 January 10th 06 12:02 AM
Locked out of Cell Formatting markvi Excel Discussion (Misc queries) 2 October 4th 05 05:11 PM
Put comments on a locked spreadsheet even though cells not locked RDP Excel Worksheet Functions 1 September 11th 05 11:59 PM


All times are GMT +1. The time now is 12:49 PM.

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"