Keep-Alive: The Macro That Covers for Your Coffee Break
A tongue-in-cheek macro that keeps your status green while you step away from your desk. Teams won't know. Slack won't know. Your conscience might.
Table of Contents
TL;DR: You’re not slacking. You’re thinking about a tax return while getting coffee. But your status dot went yellow, and now the partner is asking if you’re still online. This macro sends a tiny, invisible pulse through Excel every 60 seconds — enough to keep your status green while you review a physical file, take a bio break, or grab a third cup of coffee. Run it, step away, come back, stop it. No one will know.
The Problem
It’s February 14th. Busy season. You’ve been at your desk since 6:00 AM. The Henderson 1120S workpapers are open in Excel, the trial balance is imported, and you’re six hours into a reconciliation that could generously be described as “a mess.” Your bladder has been sending increasingly urgent signals since 10:30.
You stand up. You walk to the restroom. Three minutes — maybe four. You return to find Teams has set your status to “Away.” The partner noticed. There’s a message: “Hey, taking off early?” It’s 11:15 AM.
You explain. He says he was joking. He wasn’t joking. And the next time you need to step away — to grab a client file from the cabinet, to talk through an M-3 adjustment at a colleague’s desk, to stare at the ceiling and wonder why the prior-year depreciation schedule uses MACRS 5-year for a 7-year asset — you’ll think twice. That’s ridiculous. You’re an adult. You’re doing actual work. But the green dot controls perception, and perception matters.
This macro fixes that. It sends a harmless pulse through Excel every 60 seconds. Nothing visible. Nothing that changes your workbook. Just a tiny activity signal that tells your status monitors: “I’m here. I’m working. Go away.”
#Prerequisites & Setup
What you’ll need:
- Excel 2016+ (desktop) — the macro uses
Application.OnTime, standard VBA - An open workbook with at least one cell you can select
- That’s it. No references, no add-ins, no trust-center acrobatics.
Limitations:
- Stops when you close the workbook. The macro lives in VBA memory tied to the workbook — closing it kills the timer. If you store it in your Personal Macro Workbook, it’ll survive across workbooks.
- Won’t survive a crash. If Excel dies, the macro dies with it. But you’ll have bigger problems at that point.
- Does not click your mouse cursor. Status monitoring is based on input activity within applications — the ActiveCell toggle is input activity. But if your IT department uses aggressive screen-capture or mouse-movement tracking, a VBA macro won’t fool it. (If your IT department does that, you have worse problems than a yellow status dot.)
#The Macro
Option Explicit
' ── Module-level state ─────────────────────────────────
Private KeepAliveRunning As Boolean
Private NextPulse As Date
' ═══════════════════════════════════════════════════════
Public Sub StartKeepAlive()
' Starts the pulse loop. Safe to call multiple times —
' won't start a second loop if one is already running.
' ═══════════════════════════════════════════════════
If KeepAliveRunning Then
MsgBox "Keep-Alive is already running." & vbCrLf & _
"Use StopKeepAlive to deactivate it first.", _
vbExclamation, "Already Active"
Exit Sub
End If
KeepAliveRunning = True
Application.StatusBar = "☕ Keep-Alive active — started " & _
Format(Now, "hh:mm:ss")
KeepAlivePulse
End Sub
' ═══════════════════════════════════════════════════════
Private Sub KeepAlivePulse()
' One pulse. Called by Application.OnTime every 60 seconds.
' Do not call this directly — use StartKeepAlive.
' ═══════════════════════════════════════════════════
If Not KeepAliveRunning Then
Application.StatusBar = False
Exit Sub
End If
' ── Error-safe pulse ───────────────────────────────
' Toggle the active cell right one column and back.
' On a protected sheet, this silently does nothing.
On Error Resume Next
Dim orig As Range
Set orig = ActiveCell
ActiveCell.Offset(0, 1).Select
DoEvents
orig.Select
On Error GoTo 0
' ── Update status bar heartbeat ────────────────────
Application.StatusBar = "☕ Keep-Alive active — " & _
Format(Now, "hh:mm:ss")
' ── Schedule next pulse ────────────────────────────
NextPulse = Now + TimeValue("00:01:00")
Application.OnTime NextPulse, "KeepAlivePulse"
End Sub
' ═══════════════════════════════════════════════════════
Public Sub StopKeepAlive()
' Cancels the loop and restores the status bar.
' Safe to call even if the loop isn't running.
' ═══════════════════════════════════════════════════
KeepAliveRunning = False
' Cancel any pending OnTime event
On Error Resume Next
Application.OnTime NextPulse, "KeepAlivePulse", , False
On Error GoTo 0
Application.StatusBar = False
MsgBox "Keep-Alive deactivated. Welcome back.", _
vbInformation, "Keep-Alive"
End Sub
#How It Works
#The OnTime engine
The macro is built on Application.OnTime, VBA’s built-in task scheduler. Each
time KeepAlivePulse runs, it schedules the next run:
NextPulse = Now + TimeValue("00:01:00")
Application.OnTime NextPulse, "KeepAlivePulse"
This creates a loop: run pulse → schedule next → wait 60 seconds → run pulse →
schedule next → … It’s the same mechanism Excel uses internally for
Auto_Open, Workbook_Open, and scheduled report refreshes. No Windows API
calls, no Sleep loops, no CPU spinning.
The interval is 60 seconds. Most status platforms (Teams, Slack, Zoom) switch to “Away” after 5–15 minutes of inactivity. A pulse every 60 seconds is more than sufficient — you could increase it to 3 or 4 minutes and still stay green on any platform. But 60 seconds costs nothing and guarantees coverage even on aggressive configurations.
#Why Private matters for the pulse subroutine
StartKeepAlive and StopKeepAlive are Public — they appear in the Macro
dialog (Alt+F8) so you can run them with a click or a keyboard shortcut.
KeepAlivePulse is Private. It doesn’t appear in the macro list, which
prevents someone from running it manually and creating a second unscheduled
instance. The only way to start the loop is through StartKeepAlive, and the
only way to stop it is through StopKeepAlive.
If someone does find KeepAlivePulse in the VBA editor and runs it directly,
it checks KeepAliveRunning first — if the flag is False, it exits
immediately. The flag is the single source of truth for whether the loop is
active.
#The pulse is invisible — by design
The pulse does exactly two things:
-
Selects the cell one column to the right of the active cell, then returns. This is real input activity. Excel processes it as a selection change event. Status monitors see it as “user is actively using Excel.” The
DoEventsbetween the two selections ensures Excel actually processes the change before reversing it — without it, VBA might batch both selections into a single operation that status monitors would miss. -
Updates the status bar with the current time. This is for you, not the status monitors. If you glance at Excel from across the room, you can see ”☕ Keep-Alive active — 14:23:15” and know it’s still running. When you come back, you know to stop it.
The pulse never modifies cell values, never changes formatting, never writes to
the workbook. If your active cell is A1, it selects B1, then selects A1 again.
Your workbook is identical before and after every pulse. The On Error Resume Next wrapper ensures that even if the active sheet is protected against
selection changes, the macro keeps running — it just skips the selection toggle
and only updates the status bar.
#Starting and stopping is intentional
You have to explicitly start the macro — it doesn’t auto-run when you open the workbook. That’s deliberate. A macro that activates without your knowledge crosses the line from “convenience tool” to “sneaky.” You turn it on when you need it, and you turn it off when you’re back.
You have to explicitly stop it, too. The macro won’t auto-stop after a timeout because it can’t know how long you’ll be away. Three minutes for a restroom break? Forty-five minutes for a client meeting where you’re listening but not typing? The stop is manual and intentional.
If you forget to stop it — you close the workbook, go home, come back the next
day — the OnTime events die with the workbook session. No stale timers
survive a workbook close. There’s no risk of the macro silently running in a
file you’re not looking at.
#The stop cancels the pending timer
Application.OnTime NextPulse, "KeepAlivePulse", , False
The fourth argument, False, tells Excel: “unschedule this event.” Without this
line, calling StopKeepAlive would set the flag to False, but the next
scheduled OnTime would still fire — and KeepAlivePulse would schedule yet
another one. You’d have a zombie timer that requires closing Excel to kill.
The On Error Resume Next is there because if you call StopKeepAlive before
the first pulse ever fires, NextPulse is still the default Date value
(0 = December 30, 1899), and Application.OnTime with an expired time throws
an error. The error suppression handles that edge case and moves on.
#Adapt It
Macro security note: This is a macro-enabled workbook (.xlsm). After downloading, you may need to enable macros via File → Options → Trust Center → Trust Center Settings → Macro Settings or by clicking “Enable Content” in the security warning bar.
Get the next macro in your inbox
One copy-paste-ready macro recipe every two weeks. No spam, no VBA theory — just automation that saves you time.
Excel Macro Guy
Excel enthusiast · married to an accountant
I love Excel. My wife is an accountant. Every busy season, I watch her wrestle with workpapers and think "a macro could do that in half a second." So I build them. She tests them on real client data. What survives gets published here.