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?
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,714
Office Version
2010
Platform
Windows
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")
 

NavyJack

New Member
Joined
Jul 12, 2018
Messages
5
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. :)
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,714
Office Version
2010
Platform
Windows
Actually,

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

Forum statistics

Threads
1,081,849
Messages
5,361,679
Members
400,644
Latest member
ndroger1

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top