Open Excel and Paste in current workbook

Chandresh

Board Regular
Joined
Jul 21, 2009
Messages
115

Hi All,

can any one help me with a macro which will ask to select the excel file from the path(getopenfile method) and paste in current workbook

I am using below code however it takes long time to run

Option Explicit
Sub import()
Dim filename As String
Dim curfilename As String
curfilename = ThisWorkbook.Name
filename = Application.GetOpenFilename("Excel Files (*.Xlsx),*.Xlsx", , "Please select Master")
'filename = Application.GetOpenFilename
Application.ScreenUpdating = False
Dim x As Workbook
Set x = Workbooks.Open(filename)
With Sheets("Security List from System")
x.Sheets("Security List from System").Range("A1:L75000").Copy
End With
Windows("Report Compare V2.xlsm").Activate
Sheets.Add.Name = "Master"
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.DisplayAlerts = False
x.Close SaveChanges:=False
End Sub

Thanks
 
Last edited:

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Watch MrExcel Video

Forum statistics

Threads
1,109,308
Messages
5,527,930
Members
409,793
Latest member
mavrik_stet

This Week's Hot Topics

Top