I have a spreadsheet that gives a timestamp when the sheet is updated. There is a button on the first worksheet that queries a DB and populates the data in the second worksheet. If I put this code on the data worksheet then it becomes real slow due to updating the timestamp when each cell is updated or being populated. So how can I get this to give me an updated time without updating when each cell populates
Secondly, if I can not find a way around that, how can I have this code triggered when a button is pressed??
Private Sub workbook_Beforesave(ByVal SaveAsUi As Boolean, Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
If Not ws.Range("a1") = ws.Range("A1") Then
ws.Range("A1") = "Last Run: " & Now
ws.Range("A1") = "Last Run: " & Now
Else: End If
Next ws
' Use "Now" for date and Time, use "Date" for just date
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Range("c1") = "Last Run" & Now
End Sub