transfer data then transfer some back

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
586
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
have a spreadsheet called Book1, then transfer data to Test.

In test it calcualtes some figures which i then want to transfer back to Book1 before closing Test. Not sure where to put the code to copy from Test.xls Sheet3 A1:D1 then copy it to the initial Book.xls Sheet 1 A30:d30


NewName = ActiveWorkbook.Name

Workbooks.Open "C:My Docs\Test.xls.xls"


Workbooks(NewName).Sheets("Sheet1").Range("A101:C101").Copy
Workbooks("Test.xls").Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues


'Save and close Test Spreadsheet

ActiveWorkbook.Save
ActiveWindow.Close

Workbooks(NewName).Activate
CutCopyMode = False
ThisWorkbook.Activate
Sheets("Sheet1").Select
Range("A1").Select



End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this

Code:
Workbooks(NewName).Sheets("Sheet1").Range("A101:C101").Copy
Workbooks("Test.xls").Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Workbooks("Test.xls").Sheets("Sheet3").Range("A1:D1").Copy Destination:=Workbooks(NewName).Sheets("Sheet1").Range("A30")
 
Upvote 0
Try this

Code:
Workbooks(NewName).Sheets("Sheet1").Range("A101:C101").Copy
Workbooks("Test.xls").Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Workbooks("Test.xls").Sheets("Sheet3").Range("A1:D1").Copy Destination:=Workbooks(NewName).Sheets("Sheet1").Range("A30")

It transfers it back but just the formula, just need the answer. prob need paste special values but not sure where to add it?
 
Upvote 0
Try

Code:
Workbooks(NewName).Sheets("Sheet1").Range("A101:C101").Copy
Workbooks("Test.xls").Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Workbooks("Test.xls").Sheets("Sheet3").Range("A1:D1").Copy
Workbooks(NewName).Sheets("Sheet1").Range("A30").PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Try

Code:
Workbooks(NewName).Sheets("Sheet1").Range("A101:C101").Copy
Workbooks("Test.xls").Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Workbooks("Test.xls").Sheets("Sheet3").Range("A1:D1").Copy
Workbooks(NewName).Sheets("Sheet1").Range("A30").PasteSpecial Paste:=xlPasteValues

the above doesnt transfer anything back the cells in Book1 are now blank
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,822
Members
452,946
Latest member
JoseDavid

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