how to get static timestamp - code/formula

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
533
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Hi all,

We have the following excel sheet

Book1
ABCDE
1S.No.Drop/DownTimeStampRock
21Peter
32Hileri
43Danial
54
Sheet1


we want that when we choose any drop down than we get a static timestamp cell, can we do it with arrayformulla
 

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
Probably need event code to make it static. Put this in the worksheet code module for that sheet.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B:B")) Is Nothing Then
    Application.EnableEvents = False
    Target.Offset(, 1) = Now
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Thanks JLGWhiz, can we do it through a formula or code

Not vba

VBA is work in my case, but if we can get the formula its good for me
 
Upvote 0
Thanks JLGWhiz, can we do it through a formula or code

Not vba

VBA is work in my case, but if we can get the formula its good for me
I am confused. You said "formula or code" is OK, but "VBA" is not. "Code" is "VBA"!

Note that formulas will not work if you want a static timestamp. You have to use VBA, unless you want to manually Copy/Paste Special Values on your =NOW() formula every time.
 
Upvote 0
Ok,

code is vba, u r right and sorry for my subject and post description
 
Upvote 0
Ok,

code is vba, u r right and sorry for my subject and post description
Like @Joe4 said, formulas will not return a static value. They react to whatever action happens in the dependent or precedent cell. With the event code placed in the worksheet code module, it will react to changes made on the worksheet, and in this case, only execute the time stamp when the change is in column B dropdowns. What I did not know was if the time stamp is related to the names or the cell with the dropdown. It would make a difference of where the timestamp appears in column C.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

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