Automate data transfer between workbooks in Excel - excel

I admit to not being very technical and my limit up to now has been using paste links to connect data between sheets. I now have a requirement I cannot figure out.
I have 2 workbooks I wish to automate sharing data between.
Workbook 1 contains multiple rows of data manually entered.
I need a button against each row so when it is pressed data from certain cells on that row in Workbook 1 are transferred to cells within a worksheet in workbook 2
I would be very grateful for any guidance on how to achieve this.
Many thanks!

Though you can deploy VBA to achieve this, but the same is also possible with simple formula like.
=[1.xlsx]Sheet1!$A$1
Lets say you have two workbooks 1.xlsx and 2.xlsx and you want sheet1/column A1 value from 1.xlsx to be auto populated in sheet1/column A1 in 2.xlsx, you can simply link it with a formula like =[1.xlsx]Sheet1!$A$1 in second workbook 2.xlsx.
So as soon as some entry is done in first cell, second cell is auto populated
However if you are looking only for vba solution do write back

Related

Powershell Xlookup Multiple sheets

Hello all im not sure what im going to ask is possible but I guess ill find out.
I have 1 sheet from a ticket that has Printer numbers that I need to import to 30 sheets that hold the printers and their location. Right now I'm just opening every sheet and doing a xlookup into the column I need and then copying the xlookup to each sheet. Then pasting valuables because I don't need the formula when I'm done as the data will not change.
I would like to know if there is a way i can implement PowerShell or maybe VBA so that I don't need to open each sheet and do lookup copy column then paste text as its very time consuming. It would be a bonus if I get this to work without pulling the sheets out of sharepoint also.

Will it require me to use VBA if I want to 'copy/paste' data in workbook 2 after being entered into workbook 1?

I have started to build a couple of workbooks that I would like to communicate with each other. My goal is to take entries from column1 # midnight,6am,noon, 6pm, and 11pm in workbook1 and 'copy/paste' them to row1 with the same labels in workbook 2. My main question is do I need VBA for this? My research leads me to believe that I do. However, I know that if I am doing this between spreadsheets in the same workbook I don't. I just use code such as ='Sht1'!A1 on spreadsheet 2 and it will copy and paste that entry from spreadsheet 1, so is there a similar way to do so with workbooks? Thanks for any input!
I figured it out. INDEX function was correct, at least in this instance. The correct formula was not far off because I had my row and column messed up, so the answer was:
=INDEX('[May 2018.xlsm]1st'!$A$13:$D13,1,3)
To break it down for people that do not want to use VBA and struggle with coding like me :)
INDEX() is my function
'[May 2018.xlsm]1st'! is the name of the workbook and sheet that I want to reference and ! means that the workbook is macro-enabled
$A$13 is the beginning of my range (A,13)
$D$13 is the end of my range (D,13)
So my range is 1 row and 4 columns (Think of it like a table), yours could be whatever you want (2x4 or 6x6 or whatever size you need)
1 is the row in the range that I want to reference
3 is the column in the range that I want reference
Be sure to close the function with )
I turned out making this more complicated than it should have been, because I had merged cells and I was technically referencing the right row, but not the right column. I was using (1,2) as my row and column which was referencing my first cell.
Hope this helps.
EDIT: I found later that this only works for referencing static data, so if you use it for a template or another spreadsheet that gets updates, this is not the answer for that situation. I will update again if I figure it out.
EDIT 2: For this to work with a updating spreadsheet, do the following.
=('[June''18 7Q10.xlsm]1st'!$C$13:$D$13)
Its actually much simpler to perform than I originally made it out, but going back to my beginner programming classes I wanted to make sure I understand why it worked not only how to perform it.
The process via LINK is:
Open both workbooks (Source workbook = 1 and Updated = 2)
Find the cell you want to have the data 'Pasted' TO in (2) and edit it with =(.
Now go to (1) and click the cell the that you want to 'Copy' data FROM. This will generate a reference point for you.
Now go back to (2) and finish the function out by closing the argument with ).
Finally, simultaneously press Shift, Control, and Enter and the spreadsheets/workbooks will link, likely leaving you with your result or a 0.0 until data is updated.

Changing sheet names using a formula

I have an Excel workbook with various tabs on it.
In Sheet 1 (named: ‘Pricing Calculator’) you can input various data and it calculates a price.
Sheet 2 (named: ‘Final Copy’) is basically the same as Sheet 1, however it is not used for inputting data. So in this sheet cell A1=’Pricing Calculator’!A1 etc. for most of the sheet.
However, sometimes Sheet 1 (‘Pricing Calculator’) is copied and that and the copied sheets renamed to ‘Option 1’, ‘Option 2’, ‘Option 3’ etc. Sheet 2 (‘Final Copy’) only needs to use information out of one of these sheets, but which one will depend on which option is chosen.
I have tried adding a cell into Sheet 2 (say it was A30) where you can type in exactly the name of the sheet to get the data from, and changing the cells to =’A30’!A1 etc, but this doesn’t work because it is looking for a sheet called ‘A30’.
It works by clicking ‘replace’ and changing everything that says ‘Pricing Calculator’ to ‘Option 2’ or whatever. But I have got to password protect all of the sheets so that no one can change them, therefore I can’t use the replace method!
Does anyone have any ideas as to what I could do? I would prefer to avoid using macros or VBA if possible.
You could use INDIRECT() for this.
=INDIRECT("'" & A30 & "'!A1")

Excel Macro: Copy specific cells from multiple sheets to specific cells in separate sheet

I am new to Excel macros but have recently tried them out and find them really useful. The problem is my programming knowledge is limited to Matlab so I'm wondering if someone can suggest a macro for the following problem.
I have collected study data and I want to move it all to one Excel spreadsheet. Each sheet has data for on participant, and there are 67 sheets. The sort of macro which would be useful is one which looks in the same five cells (always D36:D40) of 67 sheets and copies it to a specific part of a row in the new sheet (AKx, ALx, AMx, ANx, AOx where x is the next row down, starting from 3, for every sheet data is copied from).
I feel by code being provided for my specific situation it will be easier for me to understand what the code does and thus I can slowly start to learn some macro code.
You don't need a macro for that. You can just include the file name in the cell referencing.
The formula looks like this:
='file:///C:/[path and filename].xlsx'#$'[sheetname]'.G22
The easiest way to accomplish this is to have both sheets open. In your main sheet, type the "=" and ALT-TAB to the other sheet, click on the cell you wish to reference. Hit return. The value from that cell will appear in your main sheet.
So your main file, can point to those 60 some-odd sheets, and whatever cells you want. Any time you update those files, your main sheet will always be up to date.

Copy excel (2007) sheet to new workbook without formulas referencing original workbook

I have a workbook with two sheets. The first is full of data and calculations, the second is mostly cells with references to the first sheet. The second sheet also concatenates strings, and references to cells in the sheet, to form SQL commands used elsewhere.
There is also a second workbook (soon to be more). It has a sheet identical to the first sheet of the other workbook, except with different data. The problem I'm having is that the new workbook needs a sheet similar to the second of the original workbook (sorry if this is sounding confusing). I would like to simply duplicate the sheet and its formulas, which I tried using the 'move or copy...' option. Unfortunately, the formulas in the cells reference the first sheet from the old workbook, like this: =[foobar.xlsx]data!A1. Way too much data to remove them by hand. I can't just redo the formulas because I had to remove a lot of specific lines from the second sheet, so dragging the formula would not match up correctly. I'm currently trying to hack this together with REPLACE but if anyone can offer help it would be greatly appreciated.
CLARIFICATION:
When I copy the sheet, a formula will appear as =[foobar.xlsx]data!A1. I want it to just be data!A1.
Thanks :)
I hope this answers your problem, but I am a little unclear on your need!!!
Highlight all cells in the worksheet.
Perform a replace to replace = with say '=
This stops the formulas "being formulas"
Copy the sheet.
Perform another replace on the new sheet to replace '= with =
This converts back to formulas, referring to cells in your new workbook.

Resources