Cat On A Spreadsheet
Once you’ve built a CRUD-style UserForm in Excel, the next natural step is sharing it with others. But when multiple users access the same workbook at the same time, conflicts happen:
Two people editing the same record simultaneously
Accidental overwrites when someone saves after another user
Deleted records still being referenced
To make your UserForm robust in a shared environment, you need to implement a record locking system.
The idea is simple:
When a user opens a record, it gets marked as “locked.”
While it’s locked, no one else can edit it.
Once the user saves or cancels, the record is unlocked.
This mimics the behavior of professional multi-user databases like Access or SQL Server, but in a lightweight Excel/VBA setup.
In your Customers sheet, add a new column:
E: LockedBy
This will store the name of the user who currently has the record open. You can retrieve the user with VBA:
Before loading a record, check if another user already has it locked.
Then update LoadRecord to respect locks:
When the user saves or cancels, clear the lock.
Update the Save and Cancel buttons to unlock after finishing.
To prevent permanent locks if a user just closes Excel, add:
You can enhance the lock system by storing not just the username but also the time when the lock was set. This allows you to auto-expire locks if someone crashes out of Excel.
Then parse that string when checking locks.
By adding a record-locking mechanism, your UserForm now supports multi-user collaboration without accidental overwrites.
Users see when a record is being edited by someone else
Locks are automatically released on save, cancel, or form close
Optionally, locks can include timestamps for auto-expiry
This transforms Excel from a single-user tool into a lightweight shared app platform—perfect for small teams that need structure without deploying a full database.
Cat On A Spreadsheet