I have a workbook which is used for processing data sets.
It's set up in such a way that it processes a bunch of data that I copy and paste into tables, and after it does all the calculations, it spits out an output sheet, as well as a bunch of charts relating to the output sheet.
I then use the Copy to another workbook option to capture the output.
My problem is this: I do this one set at a time for Mon through Fri. However, each time I update the original, the copied worksheets update to reflect the changes, meaning by the end, I have 5 days' of Friday's processed data.
Is there a way to stop this from happening?
I see that the copied/moved sheets still reference the original workbook by name...
Just tried this: Doesn't work:
XXXMaybe: moving the sheets to a new workbook instead of copying will help this, followed by closing the original processing workbook without saving, then reopening it in its blank state to process the next set of data.XXX
Thanks all.
edit: Excel 2010
edit 2: Moving then reopening doesn't help...
Related
I run VBA code on a weekly basis. The code opens a set of data, manipulates it and and pastes into another file.
In summary:
Execute from a master file
Open a CVS file and convert it to Excel columns
Delete previous data and paste the above into the master file
Apply some formulas (V-lookups to map the data)
Apply filter to select a sub set needed and copy it
Open another workbook and paste selected data
The master file does not store historical data and handles the same amount of data every time, about 5k rows.
Originally the workbook had about 2MB, nothing has changed, I have run the same macro for over one year. I just noticed it is taking a long time to open the master workbook and the size is 91MB.
I think it's because of metadata.
You could create a new sheet and work there after you finish all your work and after closing the macro delete the sheet you have being working on.
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.
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.
I have an Excel spreadsheet with multiple worksheets in it. I have found that if I save more than one worksheet as a PDF file the formula calculation option setting changes to Manual. If I save a single worksheet as a PDF it remains at Automatic. I need it to remain Automatic as sometimes the figures in the worksheet need to be amended and recalculated.
Any advice on how to get round this?
I have a lot of data into Excel files.
There are about 174 files. Each is named Book2.xslx through Book174.xlsx
I have a master document where I have a column of formulas that I would like to paste (or insert) into each of these spreadsheets without having to actually open each one individually.
Does someone know any code I can use to do this?
As an example, I would say I would want to copy the range P:P - the whole of column P - and insert it or paste it into Column P in the closed workbooks.
Can this be done? If it works , and I want to insert different ranges and cells every time I wanted something different inserted or pasted? Or is there a macro for example, that I could run , that would copy what I've selected to the same place in every unopened spreadsheet named Book*.xlsx?
You cannot do this on existing files without opening them (whether in Excel, or using FSO, as the Object Model won't be available to apply to those files
having said that, it is possible to automate the modifications using VBA.
If you would post your code, we can help you improve it or resolve any issues with bugs or performance