VBA userforms and OneDrive Sync - Simultaneouly Submiting Data - excel

I have a userform in excel VBA that about 40 people use. When submitting data through the userform to write on the sheet it works perfectly. However, I tested with 5 users simultaneously using this same form and it seems like OneDrive syncing starts to mess up with the submitions (lines are being overwritten).
Is there a work around so that this overwritting does not happen when users are submiting data simultaneously?

You haven't provided much information about how you've set this up or how it's used but, as I'm picturing the shared workbook, you could determine and "reserve" the destination location upon opening of the userform, instead of upon completion.
There are a number of issues you'd have to work through, as co-authoring in this way can be tricky, and this is not ideal. Ideally you'd be transitioning to MS Access or another relational database. (If you already know some basic VBA, the learning curve isn't as steep as it might seem.)

Related

Team working on one master workbook through database sheet on shared drive

!We have recently spent a few days developing an Excel Master workbook for our team of 4 members to streamline our administrative tasks and to improve our record keeping practices. We now have the Excel workbook working fine on a single user basis. It has VBA macros for creating new files and folders which is already working well. However, we are 4 members on the team and it is essential that we can work on this sheet simultaneously. If we opt for the Sharepoint option, we cannot use the macros. If we use the shared Excel file option, we lose the functionality of the Master workbook as we cannot make use of tables or array formulas. Any ideas on how to work around this? We have done some research and found that one idea might be to create a database where each of the team members have access to the database via a shared drive like OneDrive. But- is this the best solution? I have never coded anything like this before and it will take me a long time to learn how to do it and before spending weeks and weeks on getting it to work, I would just like to get some advice on the recommended path forward.
Here's what the current sheet does:
Saves a list of contacts.
2.Saves a list of current tasks.
Saves a list of current deals we have in the company, customer and supplier info.
The Macro then creates a relevant file per deal on our drive and embeds a subset of new Excel worksheets we use for documentation purposes.
Any help would be appreciated!

Data connection between excel workbooks: File opens when refreshing connections

I’m attempting to migrate an existing excel sheet from using links to using data connections to other excel workbooks (Excel 2010). Upon switching my first couple cells, I refreshed the connection to test it out, and while the cells populated just as I’d hoped, excel actually opened the sheet I was connecting to on top of the sheet I was working on. I did see a suggestion somewhere that implied making it a shared workbook would help, but to make the data connections work as desired, I had to create a table on a background tab, so sharing the workbook is not possible.
Is there a way to suppress the sheet I’m connecting to from opening up? I don’t want to go too far down this rabbithole if it’s always going to do this.
Bonus: VBA code for automatically refreshing links every few minutes when the sheet is open, if it’s possible (rather than having the user press a button at will), may prevent me from having to migrate over to using connections to begin with. I’ve just not had much luck finding any that might work so far.
Please let me know if you require further clarification! Thanks!

Is there a way to auto-update Excel workbook without opening it?

I'm trying to learn better excel skills by working on a hobby project. Currently, my Excel workbook grabs data from an online database and archives it via command button. When I need to, I can look at a summary sheet which analyzes the data and presents it nicely.
The problem is that I need this data to be continuous and if I'm not around to click the command button it will have gaps in the data. The more accurate the better. So, I'm looking for a way that the workbook can be opened, updated and closed without me around. Better yet, if this is possible with something like OneDrive so I don't need my pc on all day - that would be the best solution.
Can anyone suggest a way for this auto-update process to work and/or inform me if OneDrive is capable of doing it also?

Saving individual sheet in Excel VBA

Currently we have a Excel VBA application, which consists of 25-30 Excel sheet (and all of those sheets all hidden and we do background processing on them and display it to VBA forms UI), and we have developed a UI using VB forms. But problem we are facing is whenever we click on Save button using this code:
ThisWorkbook.Save
But this saves entire workbook not an individual sheet, so even if we make changes in single sheet it saves entire workbook and this save processing makes very slow (since it needs to save all excel sheet containing lot of data unnecessary, even if there is no changes).
My question is is there any way we can save "only one sheet in a particular excel sheet" not an entire excel file?
Note: I am a Java developer and I worked on VBA before, But it was years back, and I have forgotten bit. Any guidance would be appreciated. Or any pointers on how to handle this situation would be appreciated. Please let me know if you need any more information, I can edit this question.
What I have tried already? I did a lot of research from yesterday, I searched in previous questions on SO, but didn't get any useful information. As per my research it says we cannot do this. Am I on right path?
The short answer is no. You cannot save a single worksheet at a time.
You may want to try to reduce the amount of data in the workbook. Try storing data in several workbooks and when it is needed, open that specific workbook, make the needed changes, and then close it.
If it is necessary to have access to all data at once then consider using access or some other database.
It is also possible that the sheets have "blank data". Cells that don't contain anything in them but excel thinks they do so when saving it tries to save way more than needed.
Assuming that it is the active worksheet that you want to save then you could do something like this:
ActiveSheet.Copy
ActiveWorkbook.Close True, "path"
This copies the active worksheet which creates a new workbook which will become the active workbook. Then just call the close method on that and give it a file name.
I think you should consider splitting your application into multiple workbooks:
The workbook that contains all the logic, user forms and programming code. This workbook handles all other workbooks as well as the displaying of it. Potentially, this could be even an "Application Specific Addin", that stays dormant but activates as soon as any of it's subsequent workbooks gets opened. For this architecture approach check out the section on "Application Specific Addins" in this link.
This workobook/add-in can also hide the other workbooks, so that the user will not notice it's multiple workbooks.
One or multiple data workbooks: Depending how interlinked the data is, you can separate this, e.g. in a "Sales data" workbook which contains the large database, as "Base data" workbook, that contains all the smaller data (e.g. products or stores tables).
This way, you can reduce the saving to the "relevant" sheets. However, of course this requires quite a bit of reprogramming - but it's worth the effort, as for instance it also allows to provide updates/bug fixes without having the transfer the data between versions, as you only need to distribute the the file with programming logic. :-)

VBA to write data into Excel used by multiple users on a network?

Basically I have a master workbook on a network drive which is used by many to update the sheet, I want to automate this, through my research I found there are many complications with it if I automate it.
Searching on Google gave me the following suggestions and I have noted some complications with these solutions
using VBA open and write data and close it.
there are chances that Excel is already opened by others and it is in read only mode, so I can't write. Even though I tried open and write but it's taking too long getting stuck.
Share the workbook and write data
for this to happen the workbook should be opened and shared by one at least, while writing data if two people are writing data at a time there is a chance that one could overwrite data of others
using ADO write data into Excel
I don't have any idea about ADO and how it can be used to write data into Excel, saw some examples and ended up nothing to comprehend.
Set up an Access database
Connect to the database from an Excel: Go to the ribbon: Data > From Access. This almost works like a pivot table and is indeed view only.
You can also store all the data still in an Excel and again use the External Data options (From Other Sources > Wizard > Other/Advanced > (tab) Connection > Use data source name > Excel Files > OK) to connect to it from a central Excel that all users use.
For writing to your database I would recommend using VBA nonetheless, if thats beyond you then you might want to get busy with it soon as that would probably be the best way for you to enable your users to write.

Resources