Hi all,

I have the following code that I'm trying to implement. The code sums a column of data in a tab and pastes the value and time into another sheet every x minutes.

The code seems to work fine when I have the tab open and I'm sitting on it, however when I move to another tab I get an object defined error.

I've tried to counter this by including the worksheet name and sheet name in the code, but with no luck.

Eventually if I can get this to work I'd like it to have this work across 3 separate sheets, summing a column in each on a regular basis without the user being interrupted or being bothered by the code working away.

Option Explicit
Public dTime As Date

Sub ValueStore()
Dim dTime As Date
Application.ScreenUpdating = False


Workbooks("Register.xlsm").Sheets("Balance Tracking").Range("A" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = WorksheetFunction.Sum(Workbooks("Register.xlsm").Sheets("Outstanding").Range("S4", Range("S4").End(xlDown)))
Workbooks("Register.xlsm").Sheets("Balance Tracking").Range("B" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Now()

    Call StartTimer
End Sub


Sub StartTimer()
    dTime = Now + TimeValue("00:02:00")
    Application.OnTime dTime, "ValueStore", Schedule:=True
End Sub

Sub StopTimer()
    On Error Resume Next
    Application.OnTime dTime, "ValueStore", Schedule:=False
    Worksheets("Reporting").Protect Password:="RemServicesOPR2014", UserInterfaceOnly:=True
End Sub
In addition to the above I have the workbook_open and workbook_beforeclose code within the thisworkbook tab.

Any ideas on where I might be going wrong?