Two timestamps in one sheet

Dscalf1

New Member
Joined
Jun 14, 2015
Messages
41
Hello All,

I am trying to get two timestamps in one sheet. I have one range of cells (R6:AF6) and when someone types in any information in any of this range of cells I want a time stamp to show up in cell BH6. Now exactly the same I have this range of cells (AJ6:AX6) and when anyone types on any of these cells I want a timestamp to show up in cell BJ6.

I have this code and it works great for the first part if any cells are entered it shows a timestamp in cell BH 6, however I tried to copy and paste this code to do the second set and it wont work.... Any ideas?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 18 Or Target.Column > 35 Then Exit Sub
    Application.EnableEvents = False
    Cells(Target.Row, 61) = Now
    Application.EnableEvents = True
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Use this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   First one
    If Not Intersect(Range("R6:AF6"), Target) Is Nothing Then
        Range("BH6") = Now
    End If
        
'   Second one
    If Not Intersect(Range("AJ6:AX6"), Target) Is Nothing Then
        Range("BJ6") = Now
    End If

End Sub
 
Upvote 0
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Intersect(Target, Range("R6:AF1000")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 61) = Now
      Application.EnableEvents = True
   ElseIf Not Intersect(Target, Range("AJ6:AX1000")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 62) = Now
      Application.EnableEvents = True
   End If
End Sub
This puts the first time stamp in col BI as per you code
 
Upvote 0
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Intersect(Target, Range("R6:AF1000")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 61) = Now
      Application.EnableEvents = True
   ElseIf Not Intersect(Target, Range("AJ6:AX1000")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 62) = Now
      Application.EnableEvents = True
   End If
End Sub
This puts the first time stamp in col BI as per you code

This worked great thank you so much!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
Run this
Code:
Sub chk()
   Application.EnableEvents=True
End Sub
and try the code again after unprotecting the sheet
 
Upvote 0
Its not working at all now heres my code: Is something wrong?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)


ActiveSheet.Unprotect "Bakery"


   If Not Intersect(Target, Range("J6:X75")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 52) = Now
      Application.EnableEvents = True
   ElseIf Not Intersect(Target, Range("AB6:AP75")) Is Nothing Then
      Application.EnableEvents = False
      Cells(Target.Row, 54) = Now
      Application.EnableEvents = True
   End If
   
 ActiveSheet.Protect "Bakery", True, True
   
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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