Not the Usual Timestamp Question

NavyJack

New Member
Joined
Jul 12, 2018
Messages
5
I am trying to fix a timestamp issue as most have asked about in this forum; however, my question is a little different from the 75+ that have been previously asked.

I have a userform that loops through and adds rows of data to a worksheet (SurvData). In worksheet SurvData, I have a cell that is saved with the data from a dropdown menu on the Userform (Cell G2). In Cell C2, I need the timestamp to be added at the end of a Code that is decided by a formula in worksheet "Sheet1."

The formula for Sheet1 Cell A2) is as follows:

=IF(SurvData!G3="Confined Space Surveillance","C106CS",IF(SurvData!G3="Asbestos Surveillance","C106AP",IF(SurvData!G3="Electrical Frisking","C106EF",IF(SurvData!G3="Fall Protection Surveillance","C106FP",IF(SurvData!G3="Hearing Conservation","C106HC",IF(SurvData!G3="Tracked HM Storage Location","C106HM",IF(SurvData!G3="Hot Work Surveillance","C106HW",IF(SurvData!G3="Hexavalent Chromium","C106HX",IF(SurvData!G3="Hazard Communication","C106HZ",IF(SurvData!G3="Job Safety Analysis","C106JSA",IF(SurvData!G3="Lockout/Tagout Plus","C106LT",IF(SurvData!G3="Operational/Out of Service","C106OOS",IF(SurvData!G3="Lead Surveillance","C106PB",IF(SurvData!G3="Personal Protection Equip","C106PPE",IF(SurvData!G3="Respiratory Protection Surveillance","C106RP",IF(SurvData!G3="Shop Safety Surveillance","C106SI",IF(SurvData!G3="Ship Safety Surveillance","C106SS","")))))))))))))))))&timestamp()

The formula used in Cell "C2" is as follows: =IF(A2="","",Sheet1!$A2)

Currently, the result of this is as desired (e.g., C106CS1119180600), with the exception of it overwriting all previously stored timestamps each time the page is opened. I cannot figure out a way to make this formula work and NOT overwrite previous timestamps in the previous rows. Is there a way this can be done VBA that allows me to still use the IF() statement above?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You would need to enter the formula via VBA in the worksheet change event for SurvData!G3
Code:
Sheet2.Range("A2").Formula = thatFormula & Format(Now, " mmddyyhhmm")
 
Upvote 0
shg,

Thank you for your reply. I must've been seriously over-thinking this. I wasn't sure I could use the actual formula via VBA. I truly appreciate the help. :)
 
Upvote 0
Actually,

Code:
Sheet2.Range("A2").Formula = thatFormula & " & " Format(Now, " mmddyyhhmm")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

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