VBA to transfer data from one workbook to another

Robert_Conklin

Board Regular
Joined
Jun 19, 2017
Messages
173
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have this particular piece of code that transfer data from a source workbook to a repository workbook. The problem that I am having is that it will not post the data to the bottom of the list. It overwrites the top rows of data. I have tried setting up tables on the destination workbook, but that did not work. All of the other code that transfers data between the two workbooks works perfectly and is set up the exact same way. Does anyone have any suggestions?

Below is the piece of code:

sLR = .Range("A" & Rows.Count).End(xlUp).Row dLR = dAE.Range("A" & Rows.Count).End(xlUp).Row + 1
.Range(.Cells(2, "E"), .Cells(sLR, "E")).Copy Destination:=dEXT.Range("A" & dLR)
.Range(.Cells(2, "C"), .Cells(sLR, "C")).Copy Destination:=dEXT.Range("B" & dLR)
.Range(.Cells(2, "G"), .Cells(sLR, "G")).Copy Destination:=dEXT.Range("C" & dLR)
.Range(.Cells(2, "J"), .Cells(sLR, "J")).Copy Destination:=dEXT.Range("D" & dLR)
.Range(.Cells(2, "T"), .Cells(sLR, "T")).Copy Destination:=dEXT.Range("E" & dLR)
.Range(.Cells(2, "K"), .Cells(sLR, "K")).Copy Destination:=dEXT.Range("F" & dLR)
.Range(.Cells(2, "U"), .Cells(sLR, "U")).Copy Destination:=dEXT.Range("G" & dLR)
.Range(.Cells(2, "V"), .Cells(sLR, "V")).Copy Destination:=dEXT.Range("H" & dLR)
.Range(.Cells(2, "H"), .Cells(sLR, "H")).Copy Destination:=dEXT.Range("I" & dLR)
 
Place the macro in a regular module in the "PLANT PARTS...." workbook. I didn't look at any other macro that was already there. I simply wrote a new one based on your request. Does that not work for you?
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
No, the code does not transfer the data. The only data that transfers is the EXTEND data that I already had coded. If you will look at the code in the "mBASIC_4x4" module in the "PLANT PARTS MAINTENANCE V 2.7 (RAW DATA) workbook, you will see the code that transfers data from another worksheet to the same worksheets in the destination file. There should be a way to tie into the code that already exists to do the transfer from the "RAW DATA" tab as well.

On another note, the "RAW DATA" tab will be hidden from my end-users. This particular tab is only used by me and my team.
 
Upvote 0
I'm sorry but it's difficult for me to follow what your macros are doing. The macro I suggested works as you requested on the two workbooks. You can simply add the code to an existing module and it should work provided that the "RAW DATA" sheet is the active sheet.
 
Upvote 0
Ok, I will play around with it. Thank you for your help! Since my team and I will be the only people using this particular worksheet and code, I will probably replace the code I have with the code you wrote.

Thanks again, and have a Happy New Year!!
 
Upvote 0
You are very welcome. :) Thank you and the same to you.:beerchug:
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top