View Single Post
 
Old 09-05-2018, 10:44 PM
Josh1012 Josh1012 is offline Windows 10 Office 2010 64bit
Novice
 
Join Date: Sep 2018
Posts: 12
Josh1012 is on a distinguished road
Default Copying From One Workbook to Another Workbook

Hi,



I'm in the process of copying a lot of data from many workbooks to a master workbook, and I want to see If I can Loop through Each workbook and copy a range of data from 2 different sheets within each workbook back to one sheet in the master workbook. It's taken me days just to copy data and it's a waste of my time and would appreciate any help I can get to write a piece of code that does this.


Also the simple method of using the following code below to copy to another workbook does not work and always follows with an error.



Workbooks("Gerotor Design Studio Results.xlsm").Sheets("Sheet5").Range("A1").Copy _ Destination:=Workbooks("Book1.xlsx").Sheets("Effic iency Map")


Also the workbooks I want to copy data from are essentially in the same format and thus the cell locations do not change which I hope makes it easier.



From the book 1 attachment, I want to copy the flow rates from Sheet("Flow_Pressure") and the Volumetric and Mechanical Efficiency from Sheet("Efficiencies") and then past them into my master workbook("Gerotor Design Studio Results("Master") into Sheet1.



At the moment I've been using the following code to copy the data I want to a new sheet and then manually copying it into my master workbook:


Sub LowToHighSpeedsLowPressures()

Sheets("Flow_Pressure").Range("C4:C9").CopyDestina tion:=Sheets("Sheet5").Range("A1:A6")
Sheets("Flow_Pressure").Range("C10:C15").CopyDesti nation:=Sheets("Sheet5").Range("A17:A22")
Sheets("Flow_Pressure").Range("C16:C21").CopyDesti nation:=Sheets("Sheet5").Range("A33:A38")
Sheets("Flow_Pressure").Range("C22:C27").CopyDesti nation:=Sheets("Sheet5").Range("A49:A54")
Sheets("Flow_Pressure").Range("C28:C33").CopyDesti nation:=Sheets("Sheet5").Range("A65:A70")
Sheets("Flow_Pressure").Range("C34:C39").CopyDesti nation:=Sheets("Sheet5").Range("A81:A86")

Sheets("Efficiencies").Range("C4:C9").CopyDestinat ion:=Sheets("Sheet5").Range("A177:A182")
Sheets("Efficiencies").Range("C10:C15").CopyDestin ation:=Sheets("Sheet5").Range("A193:A198")
Sheets("Efficiencies").Range("C16:C21").CopyDestin ation:=Sheets("Sheet5").Range("A209:A214")
Sheets("Efficiencies").Range("C22:C27").CopyDestin ation:=Sheets("Sheet5").Range("A225:A230")
Sheets("Efficiencies").Range("C28:C33").CopyDestin ation:=Sheets("Sheet5").Range("A241:A246")
Sheets("Efficiencies").Range("C34:C39").CopyDestin ation:=Sheets("Sheet5").Range("A257:A262")

Sheets("Efficiencies").Range("D49").CopyDestinat ion:=Sheets("Sheet5").Range("A333:A338")
Sheets("Efficiencies").Range("D1015").CopyDestin ation:=Sheets("Sheet5").Range("A349:A354")
Sheets("Efficiencies").Range("D1621").CopyDestin ation:=Sheets("Sheet5").Range("A365:A370")
Sheets("Efficiencies").Range("D1015").CopyDestin ation:=Sheets("Sheet5").Range("A381:A386")
Sheets("Efficiencies").Range("D1621").CopyDestin ation:=Sheets("Sheet5").Range("A397:A402")
Sheets("Efficiencies").Range("D1621").CopyDestin ation:=Sheets("Sheet5").Range("A413:A418")

Application.CutCopyMode = False
End Sub
Attached Files
File Type: xlsx Book1.xlsx (24.1 KB, 9 views)
File Type: xlsx Gerotor Design Studio Results.xlsx (350.6 KB, 9 views)
Reply With Quote