Auto Date / Time Stamp Within Single Cell Anytime Data Entered in Worksheet

tobink

New Member
Joined
Nov 21, 2012
Messages
8
I wrote a date/time stamp macro to auto update in a single, specified cell every time data is changed or entered in any other cell for specific worksheets in a workbook that have various other macros and functions. The code works perfectly when the sheets are NOT protected; however, it no longer functions when the worksheets are protected, giving me a "runtime error 1004"?? The following is what I have:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D3:AJ100")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B1").Value = Now
Application.Enable Events = True
End Sub

I am very new to this, so any help would be greatly appreciated! Thank you for your time and Happy Holidays.

-Kristin
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this after you have inserted your password where noted in bold red font:
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Protect Password:="your pswd here", userinterfaceonly:=True
If Intersect(Target, Range("D3:AJ100")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B1").Value = Now
Application.EnableEvents = True
End Sub
 
Upvote 0
Try this after you have inserted your password where noted in bold red font:
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Protect Password:="your pswd here", userinterfaceonly:=True
If Intersect(Target, Range("D3:AJ100")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B1").Value = Now
Application.EnableEvents = True
End Sub

Thank you so much! This worked perfectly and has solved my problem!
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top