I have a function that I made with help from here that sums up time.
At the minute P2 says 00:45 minutes - which is correct.
On sheet 3 (stats) [i deleted sheet 2], I have a PivotTable based on sheet one. After noticing the PT doesn't auto-update, I made a button on the spreadsheet, and made the following macro:
On click my PT updates, but my value on sheet1.P2 goes to 00:00. doing a recalculate on p2 brings back my value.
Any hints why?
Code:
Function totalTime()
Dim lastCell As Long
'Goes to last row of the column
lastCell = Range("M" & Rows.Count).End(xlUp).Row
totalTime = WorksheetFunction.Sum(Range("M2:M" & lastCell))
Application.Volatile
End Function
On sheet 3 (stats) [i deleted sheet 2], I have a PivotTable based on sheet one. After noticing the PT doesn't auto-update, I made a button on the spreadsheet, and made the following macro:
Code:
Sub refresh_click()
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables("HDstats")
pt.RefreshTable
End Sub
Any hints why?