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. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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