user3246361
user3246361

Reputation: 21

How can multiple users run macros on a shared excel file?

I have an excel file on shared location where multiple users (4 in this case) are accessing the file at the same time.

This file has a “Master data” tab where all the base data is there and then there are 4 identical tabs (one for each user).

Each user tab has a set of filters using which the user will be able to extract relevant data based on the filters selected and can add or edit the rows. Once the user is done editing/adding rows, user will submit the data which will get updated/appended in the master data tab.

Users can select same or different options in the filters. I am facing errors when multiple users click on the submit button (macro) at the same time.

How can I resolve this?

Upvotes: 2

Views: 17502

Answers (2)

Arthur Gelcer
Arthur Gelcer

Reputation: 69

Adding to Manuel Allenspach's response, my suggestion is to create a queue.

Queue should have a spot for user processing and other spots for users waiting.

Than, before running code, you should include a check to make sure no two users have their macros updating database at same time.

Upvotes: 0

Manuel Allenspach
Manuel Allenspach

Reputation: 12735

Like some comments say, Excel is not designed for this...

But if you want to use Excel, i would recommend something like this:

Every time someone writes in the master data, you have to "lock" the master data tab. Just put a boolean in a cell, set it to true while you are writing and back to false as soon as you finished altering the master data tab.

Now, if someone wants to change values in the master data tab at the same time, check if the boolean is set to true. If yes, then you have to wait, if not, you can write the data.

Upvotes: 1

Related Questions