Copy data from user selected source file to current opened import file from multiple ranges and sheets

oblix

Board Regular
Joined
Mar 29, 2017
Messages
183
Office Version
  1. 2010
Platform
  1. Windows
Hi there
This is realy getting my panties in a knot
Many videos and forum samples gives examples of letting users select there own source file for copying one simple range......but I am trying to do the following:

Aim
1. Let user select source file and export to current opened workbook with multiple ranges
2. Export ranges given to new file location as paste special values
All file has the exact sheets and exact cells


Data
source file(user selected) copy range:
1. Sheet9 (U4).current region to current opened file Sheet6 (C6).current region
2. Sheet1 (O3).current region to current opened file sheet3 (C6).current region
3. Sheet68 (E72:E91,E6:E26,G5,G6,G9,,G11,G13,G17,G18,G26) to current opened file sheet68 (E72:E91,E6:E26,G5,G6,G9,,G11,G13,G17,G18,G26)

I looked at various codes to start with and decided to use
Leila Gharani's sample from here video "VBA to BROWSE & COPY Data from SELECTED File in Excel"

Code below all credit to Leila:

Sub Get_Data_From_File()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets(1).Range("A1:E20").Copy
ThisWorkbook.Worksheets("SelectFile").Range("A10").PasteSpecial xlPasteValues
OpenBook.Close False

End If
Application.ScreenUpdating = True
End Sub

But no matter how I tried to use this and incorprate what I need...I just couldnt make it work

Please help
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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