Macro to copy specific sheets and paste these on respective sheet in destination workbook

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I have code to open multiple files and to copy data but need help in amending the code per my requirements in post # 1

Code:
 sub Open_Workbook()
ChDir ("C:\fixed assets")
A:
Dim A     As Variant
Dim LR As Long
     A = Application.GetOpenFilename(MultiSelect:=True)
    If TypeName(A) = "Boolean" Then Exit Sub
   
    Dim file As Variant
   
    Application.ScreenUpdating = False
   For Each file In A
        With Workbooks.Open(file)

    
        With Sheets(1)
            .Range("a1", .Range("J" & Rows.Count).End(xlUp)).Copy _
                Destination:=ThisWorkbook.Sheets("Data Import").Range("A" & Rows.Count).End(xlUp).Offset(1)
       
        
        End With
 
        .Close SaveChanges:=False
    End With
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,544
Messages
6,120,126
Members
448,947
Latest member
test111

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