Static Timestamp VBA - need help!

Mgibson022

New Member
Joined
May 13, 2022
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
Hi there,

I have created a timestamp using VBA, however when I filter data in my table or add a row, it changes the date/time to the current date/time for every entry that the timestamp is showing for.

I need the date/time stamp to be static and apply to a cell when the prior data in the column before it shows as "yes".

The current VBA code I have is:

Function MyTimestamp(Reference As Range)

If Reference.Value = "Yes" Then

MyTimestamp = Format(Now, "mm-dd-yyyy hh:mm:ss")

Else

MyTimestamp = ""

End If

End Function

Can anyone please help to correct this? I've spent hours trying to figure out how to correct it.

Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
The code you are showing is a Function that does it's job; it would be interesting to see the macro that 'calls' it.
Elsewise, just add an If/Then to test if the cells already have a date then abort macro for that/those cell/s.
 
Upvote 0

Forum statistics

Threads
1,214,521
Messages
6,120,018
Members
448,937
Latest member
BeerMan23

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