Copy/Paste from 2 into 1

dwool40

New Member
Joined
Apr 27, 2018
Messages
46
Office Version
  1. 365
Platform
  1. Windows
I am currently using the following to copy/paste from a downloaded workbook into an open workbook.

VBA Code:
Sub Copynotice()
'enter correct path to Downloads folder
    sFile = "C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx"
    If Dir(sFile) = "" Then
        MsgBox "Please download today's Report."
        Exit Sub
    End If
Dim wb1 As Workbook, wb2 As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
'enter correct path to Downloads folder
Set wb2 = Workbooks.Open("C:\Users\User1\Dropbox\z_sync_do_not_delete\Downloads\DataGridExport.xlsx")
wb2.Sheets("Report1").Range("E2:E120").Copy
wb1.Sheets("Notice").Range("D2").PasteSpecial Paste:=xlPasteValues
wb2.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

I would like to copy from DataGridExport.xlsx AND DataGridExport (1).xlsx. The ranges and destinations are the same. The only thing that changes is the (1) on the additional workbook. How would I do this?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hey @dwool4
Are you looking to merge the info or just consolidate into a single workbook?
 
Upvote 0
Hey @dwool4
Are you looking to merge the info or just consolidate into a single workbook?
@gitmeto I am looking to have the info from DataGridExport (E2:E120) and DataGridExport (1) (E2:E120) moved to Notice (D2).

I'm hoping you can download the samples with THIS LINK.
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,593
Members
449,038
Latest member
Arbind kumar

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