Forum Discussion
simonnw1025
Aug 26, 2024Copper Contributor
Automated Date Stamping Formula
Hello
I have a spreadsheet for finances and I want a formula that takes a total from another sheet every day and records it. Maybe at 9am. It then won't change.
Currently I have to go to copy and paste values but I have to do it daily.
Any suggestions or am I hoping too much?
3 Replies
- JKPieterseSilver ContributorWhich version of Excel are you using and on what platform? E.g. is this Desktop Excel or Excel on-line? Is it on Windows or on a Mac (or on your mobile)?
- simonnw1025Copper ContributorDesktop Excel
Version 16.86
On an iMac. Thanks- JKPieterseSilver Contributor
simonnw1025 Assuming your finances sheet is called "Finances" and the cell you are taking the total from is on a sheet called "TotalSheet", cell B75. Further assuming you want to list the historical values in columns Y (date) and Z (total).
This macro should do the trick:
Sub StoreTotal() Dim ttl As Variant ttl = ThisWorkbook.Worksheets("Finances").Range("B75").Value With ThisWorkbook.Worksheets("TotalSheet") 'See if we need to add a heading If .Range("Y1").Value = "" Then 'no heading, add one .Range("Y1").Value = "Date" .Range("Z1").Value = "Total" End If 'find the first empty row in column Y With .Range("Y" & .Rows.Count).End(xlUp).Offset(1) .Value = Date .Offset(, 1).Value = ttl End With End With End Sub