Time Stamp Problems

seljo

New Member
Joined
Sep 29, 2006
Messages
12
Ok, Here is my problem, I am wanting to put a time stamp in cell D5 when cell B5 is altered, so I have that part. I was able to do this with a VBA I got from this site (Thanks to pennysaver and everyone else). Now the problem is that I want to do this same procedure again in the same spread sheet but this time when cell E5 is altered cell F5 denotes the change. I have tried entering in the same VBA code twice denoting the changes in range and offset but I get an error message of Ambiguous name detected: Worksheet_Change. So I changed the title to Worksheet_change1, which gets rid of the error message but then the spread sheet does nothing when information is changed in cell E5. Any help here would be greatly appreciated. By the way here is the code I am currently using.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim keyRange As Range
Set keyRange = Range("b5:b44")
If Not Intersect(keyRange, Target) Is Nothing Then
ActiveSheet.Unprotect "password"
Target.Offset(0, 2) = Time
ActiveSheet.Protect "password"
End If
End Sub

Private Sub Worksheet_Change1(ByVal Target As Range)
Dim keyRange As Range
Set keyRange = Range("e5:e44")
If Not Intersect(keyRange, Target) Is Nothing Then
ActiveSheet.Unprotect "password"
Target.Offset(0, 1) = Time
ActiveSheet.Protect "password"
End If
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
One more question instead of only displaying tme in my code I would like to also display the date. What is the word to use for this?
 
Upvote 0
I figured out how to enter both date and time, just replace time with now(). I should have thought of that before posting.
 
Upvote 0
To give you a little more information if I have both codes in the sheet I get the date and time in more cells than I want it in. It seems that there should be an easy fix for this but I just cant figure it out. So any help would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,222,018
Messages
6,163,423
Members
451,835
Latest member
kristianb63

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