Copying Data From One Workbook To Another

timpickup

New Member
Joined
May 14, 2015
Messages
14
Evening,

I am trying to copy the data from One excel document to another but am having a difficult time with it.

One workbook is permanently open, this is the one that needs to import the data. (Main)
The other, is closed in a folder, this is the one that I need to copy the data from. (Source)

I need to copy all the data from a sheet named "page" in the Source file and paste it into sheet "ActiveData" on the Main file...

The data to be copied is around the range "A1:I400" but I need to copy it all over and have yet not found a way that will work for me.

Also, I'd like it to be as discreet as possible, to run in the background and not interrupt a page that is the permanent display being shown if that's possible.

Thanks in advance for your help :)
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
switch on macro record, open the closed workbook, copy A1:I400, close the workbook, select sheet active data, paste, stop macro, look at the code for inspiration
 
Upvote 0
thisworkbook is named bob1test.xls
part11descr1
part22descr2
part33descr3
part44descr4
part55descr5
this macro opened a new workbook, copied a range of data,
closed the new workbook and pasted the data into here.
Sub Macro4()
'
' Macro4 Macro
' Macro recorded 24/10/2017 by bob
'
'
Workbooks.Open Filename:="F:\Robert\forumoct232017.xls"
Range("K2:M6").Select
Selection.Copy
ActiveWindow.Close
Range("D6").Select
ActiveSheet.Paste
End Sub

<colgroup><col span="14"></colgroup><tbody>
</tbody>
 
Upvote 0
How about
Code:
Sub copydata()

    Dim DestSht As Worksheet
    Dim SrcSht As Worksheet
    Dim Wbk As Workbook
    
    Application.ScreenUpdating = False
    
    Set DestSht = ThisWorkbook.Sheets("[COLOR=#0000ff]ActiveData[/COLOR]")
    Set Wbk = Workbooks.Open("[COLOR=#0000ff]C:\Users\Fluff\Documents\Excel files\Book22.xls[/COLOR]")
    Set SrcSht = Wbk.Sheets("[COLOR=#0000ff]Page[/COLOR]")
    SrcSht.Range("A1", SrcSht.Range("I" & Rows.Count).End(xlUp)).Copy _
        DestSht.Range("A" & Rows.Count).End(xlUp).Offset(1)
    Wbk.Close , False
    
End Sub
Changing values in blue as needed
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,179
Latest member
fcarfagna

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