RE: Cryptocurrency Accounting in Excel by konstantint

View this thread on steempeak.com

Viewing a response to: @susueng/re-konstantint-cryptocurrency-accounting-in-excel-20170830t030113634z

· @konstantint · (edited)
Of course you can also add logic to recalculate the sheet automatically at regular intervals. One way to do this could be to add a new module with, for example, the following code:

```
Private Running As Boolean

Public Sub StartTimer()
    Running = True
    Call TimerEvent
End Sub

Public Sub StopTimer()
    Running = False
End Sub

Public Sub TimerEvent()
    Workbooks("Book1").Worksheets(1).Calculate
    If Running Then
        Application.OnTime Now + TimeValue("00:00:10"), "TimerEvent"
    End If
End Sub
```
(Note that you'd need to replace "Book1" with the appropriate name, or simply use `ActiveWorkbook` in place of `Workbooks("Book1")`, although then the timer will be recalculating whatever workbook you have open at the moment).

You can start the timer by running the `StartTimer` macro (using the "Run" button) and stop it using `StopTimer`.

It might make sense to also add something like this to the code of `ThisWorkbook` module, so that the timer will start and stop automatically:
```
Private Sub Workbook_Open()
    Call StartTimer
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Call StopTimer
End Sub
```
properties (22)
post_id11,458,144
authorkonstantint
permlinkre-susueng-re-konstantint-cryptocurrency-accounting-in-excel-20170830t083538814z
categoryhowto
json_metadata"{"app": "steemit/0.1", "tags": ["howto"]}"
created2017-08-30 08:35:42
last_update2017-08-30 08:37:36
depth2
children0
net_rshares0
last_payout2017-09-06 08:35:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,150
author_reputation360,301,994,866
root_title"Cryptocurrency Accounting in Excel"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000