Excel Workbook Linked to Another Workbook with a Changing Name - excel

Is it possible to link two workbooks in Excel and have the links remain intact if I change the name of one of the workbooks? I am constantly updating the name of one of the workbooks to reflect it's version number (i.e. I change Workbook_v1.xls to Workbook_v2.xls when I make progress on it). Anybody out there know if there are any workarounds to make my links in the unchanged workbook stay intact when I change the name of my other workbook?
Here is my sumif that I am using to get information from another workbook.
=SUMIF('[Workbook_v1.xlsm]Sheet1'!$A$1:$A$10,$D$1:$D$10,'Sheet3'!$B1:$B10)
You can see the problem I have if I change the name to Workbook_v2, the link is no longer supported. Thank you for any insight you may have!

Related

Update vba, macros and user forms in older workbooks

Good day,
My Google-fu has failed me as I've searched and am unable to locate the information I require.
I have a master workbook, when it is ran, it will create another workbook based on cell values and the master closes and remains unchanged, the new workbook is then used to store information and is saved to an Archive folder when the workbook is closed. This archived workbook can be opened in future to edit or resend data but if the master workbook is opened it starts all over as blank and as stated creates a new workbook again.
It has 5 modules, 14 userforms and also uses code in ThisWorkBook and some save codes on different worksheets throughout.
When I update something, like add or modify a userform, I email the change out to 13 different emails and attach the master workbook which they download and replace it and carry on. The workbook has to remain as one file and has to run without internet access as they're MS Surfaces that are used in an outside work environment and internet access is not always available.
I have found some things regarding this but they usually only export and import bas.
I would like to know if anyone knows of a way or a source to update all the modules and userforms in workbooks in Archive.
The user will download the master from the email, replace the previous and when it is ran it will pull the updated forms and code from it and export them to the older workbooks in the Archive folder so the new additions can be used in the older workbooks. I also require that the information on the worksheets in the old workbooks remains unchanged.
The master would need to update multiple workbooks at first run, then not run again until the next update when it replaced again. I can do this by using a cell value like if A1 = 1 then don't run for example.
I haven't tried anything yet as I only found the bas export, importer as stated.
I apologize for my wall of text and I hope I am clear on my scope.
Thank you for your time.

Dynamic Workbook Name changes and cell references - Is it possible?

my question is a pre-code question, as I would like to verify if and which is the best option to go about this - either formula, VBA or not possible.
I have a main workbook with an array of codes inside cells in sheet 1 - all in the format HXXX-XXX-XXX where X is numbers ranging from 0-9. Each code has an associated revision number as shown in the attached picture.
The workbook itself is named in the format: 'HXXX-XXX-XXX-YY Example Title' where YY can be any number starting from 0 to infinity (in theory). Only YY is subject to updates in the title. If changes are made in this workbook, then a new version is saved, with the YY changing in the title to the next consecutive number - Nothing else changes.
From this main workbook there are a large number of other workbooks (around 50) which share the same codes and revisions. My goal is to link all these workbooks up so that I only have to update a core main workbook and the rest of the codes (HXXX-XXX-XXX) revisions in all the other linked workbooks update accordingly.
The problem is that the other linked workbooks have a dynamic name in the format: 'HXXX-XXX-XXX-YY Example Title 2' where YY can be any number starting from 0 to infinity. YY gets updated to the next consecutive number if a change is made inside the document and this document is then saved as a separate document using Save As. NOTE: not all workbooks will get updated at the same time, as it all depends on which codes and therefore revisions are changing.
My question is firstly, is this possible with current excel functions to update links with ever-changing workbook links, which are saved as different files each time in the same folder?
Secondly, I have read about the INDIRECT function, but it is limited only to having the required workbooks opened at the same time as the updates to the main workbook, hence I am unsure that Formulas will work (I will be linking 50 workbooks to the main workbook) - From this I am gauging that VBA may be the best option, but I would like to double check this is possible before I begin attempting the code.
Of course the use of Formulas in the sheets would be much better, but because the file names are dynamic, and since the updated workbooks are saved as different files each time changes are made to it, I don't believe this is possible.
If I understand your problem correctly you need to differentiate between 3 things.
Using only Excel Formulas.
The problem with this is that formulas crossing workbooks have the big disadvantage, that you need to have the source-workbook open, otherwise manny formulas will not work correctly or update. You also have the disadvantage that saving the file needs still to be done automatically. The advantage is that you do not need VBA macros.
Using Power Query
With Power Query youmight be able to solve the problems with the dynamic names.You can even read a whole folder of files, combine them and do transformations without the need to open the files manually. But you still need to save new files manually and the files will only update once they are opened.
Using VBA
You can prettymuch do everything you asked in your problem description but VBA has its own disadvantages. Firstly the file-format ".xlsm" is not allowed by the IT department everywhere. Also to work, every user using the files needs to activate macros, otherwise the macros won't get executed. Therefore I think a VBA solution is better fitted if you only have a small circle of users or if you can execute the macros on your own (e.g. if the main workbook was updated, you need to execute a macro which opens, modifies and saves all affected files). After that you colleagues do not need VBA themself.
Possible solution:
To avoid VBA you could try to create a Power Query in each "other workbook". The query will read all filenames in the folder where the main workbook is located. Now you sort and filter for the workbook with the newest/highest ID/Titel automatically and load the result as an seperate Excel sheet (all that is possible with power query and without VBA).
Now you can use the "indirect" formula to use the ID/Titel to link to the newest main workbook. As mentioned above this will require that the main workbook is opened. Otherwise the indirect formula will not update the values. If that is out of the question, you probably need to go with VBA.

Excel shared workbook, resolve conflicts automatic/with vba or just ignore

I tried to share a workbook on onedrive and allow others to read/write.
The workbook is a fully automated workbook driven by VBA. Nothing is edited manually.
The workbook uses VBA to download data from internet and parses it on to the sheet. It adds one line of data on the last row of one of the sheets.
Other sheets are updated via Excel formulas or pivot tables.
So it's one line at the time that is added. And the data is added once every 10 minutes.
The problem I have is that when my computer adds data to the workbook the other users will get a conflict that Excel can't resolve even though the data is exactly the same.
Is there any way to resolve the conflict automatically, or use a VBA solution or just set it to always ignore since someone else has already saved the same data just prior.
I tried to add a Application.DisplayAlerts = False before the save but that didn't help.
Any suggestions to suppress the error message that the merge of workbooks was not possible?
EDIT:
The problem can be described as following.
You and me have the file open, it's empty.
You put "A" in A1 and save.
I put "B" in A2 and save.
The merge can be done, no conflict.
You put "A" in A1.
I put "B" in A1.
Conflict, merge is not possible.
The problem I have is:
You put "A" in A1.
I put "A" in A1.
Now there shouldn't be a conflict. But there is by some reason.
The error message is:
It can't merge the changes with the changes someone else did to the file.
Save as a new copy or ignore my changes (and reopen the file).
EDIT 2
A possible solution would be to refresh the workbook or sheet before you save but as I have understood from googling it's not possible.

Possible to link data between two excel workbooks on SharePoint?

The question concerns 2 excel files that now reside in SharePoint. The solution was easy when they were both in Excel, but now the link is unsupported. I am looking for a workaround...
Workbook B contains a data set that needs to be linked to cells in Workbook A.
Workbook A is viewed by the entire department, while Workbook B will remain separate and is used by a smaller group.
When Workbook B is updated with new data, it should automatically update Workbook A as well.
This seems to be problematic (impossible?) in SharePoint. I would also be open to having Workbook B live on my hard drive if that helps to link the files. We are just trying to keep many changes made by many users in sync between documents.
Thanks in advance for your help.

Change Workbook Names to standard names in VBA

I am working with a pretty long VBA code in Excel that references multiple workbooks. The issue I have is that the name of each workbook changes each month to reflect the new month/date, which then requires me to update the code with the new workbook name in order for it to work. Further, the change in name is not always standard across each month.
Is there any way I can, for purposes of the VBA code, rename each workbook that the code uses some standard name so that I do not need to change it each time? I know I can just create a new variable, call it "book1" and change its definition to reflect the workbook's new name, but everyone who will use the macro does not know how to use VBA and thus cannot go in each month and just change the name of the variable. Ideally I want VBA to always recognize the file, regardless of its real name, as another name, one that I set and does not change. I'm thinking there is some "technical name" that is attached to each file that does not change which I can use?
I have toyed with the idea of using dialogue boxes so the user can input the new name of the files, and thus have the code change accordingly, but would like to avoid that if possible.
This may or may not be possible, but thank you for your help nonetheless!
2 possibilities:
You could put in an extra sheet in the workbook, and in this sheet define that the file name is correct. Any Excel-User should be able to keep that info up. You could of course then check - before running your Long VBA code - if the files exist.
If the file name for example is "filetobeused12_august2013" then you could search for the newest file that starts with "filetobeused12" and use this file in your code. This is the more complex approach for sure!
hope that helps,
max

Resources