•1 min read•from Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community
How to trend an updating cell automatically
So I have this excel tracking my assets and giving a total value in cell B4, it updates automatically or when you F9.
Now I’d like to track the history of this value in a graph by writing the cell’s value away with a timestamp every time I open up the file after it has refreshed that cell.
Which is the best way to handle this Excel Masters? 🙏🏼
Fixed with this VBA script(which also autosaves daily value on open & removes duplicates):
Sub LogAssetValue() Dim wsSource As Worksheet Dim wsHistory As Worksheet Dim lastRow As Long Dim lastDate As Date Set wsSource = ThisWorkbook.Sheets("All") Set wsHistory = ThisWorkbook.Sheets("History") lastRow = wsHistory.Cells(wsHistory.Rows.Count, 1).End(xlUp).Row ' Get last logged date If lastRow > 1 Then lastDate = wsHistory.Cells(lastRow, 1).Value Else lastDate = 0 End If ' Only log if today not already logged If lastDate <> Date Then wsHistory.Cells(lastRow + 1, 1).Value = Date wsHistory.Cells(lastRow + 1, 2).Value = wsSource.Range("B4").Value End If End Sub Private Sub Workbook_Open() Call LogAssetValue End Sub [link] [comments]
Want to read more?
Check out the full article on the original site
Tagged with
#Excel compatibility
#Excel alternatives for data analysis
#Excel alternatives
#rows.com
#google sheets
#financial modeling with spreadsheets
#row zero
#real-time data collaboration
#no-code spreadsheet solutions
#real-time collaboration
#Excel
#VBA
#asset value
#tracking
#cells
#log
#timestamp
#graph
#history
#value