+ Reply to Thread
Results 1 to 4 of 4

Copy excel file from a specific folder to the open excel worksheet.

  1. #1
    Registered User
    Join Date
    06-26-2019
    Location
    Portland, Ct
    MS-Off Ver
    10
    Posts
    11

    Copy excel file from a specific folder to the open excel worksheet.

    I'm trying to run the Marco listed below but it's not opening the specific folder for me to select the excel sheet I want it to copy...I have to Brower to it. How can I indicate that I want it to go to the following folder. C:\Users\olayo_000\Desktop\Supplements\Daily List

    Sub Get_Data_From_File
    Dim FileToOpen As Variant
    Dim OpenBook As Workbook
    FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range")
    If FileToOpen <> False Then
    Set OpenBook = Application.Workbooks.Open(FileToOpen)
    OpenBook.Sheets(1).Range("A1:B595").Copy
    ThisWorkbook.Worksheets("NON GV FIs").Range("h6").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    OpenBook.Close False
    End If
    End Sub
    Last edited by timacrafts; 09-25-2020 at 04:30 PM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Copy excel file from a specific folder to the open excel worksheet.

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.

    The routine works not by copying and pasting, but by assigning the values in the source range to an array, and then assigning the values in that array to the target range.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    06-26-2019
    Location
    Portland, Ct
    MS-Off Ver
    10
    Posts
    11

    Re: Copy excel file from a specific folder to the open excel worksheet.

    This worked....Thanks!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Copy excel file from a specific folder to the open excel worksheet.

    Hi again,

    Many thanks for your feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel VBA Automate to open CSV comma delimited file and copy to worksheet
    By Jovillanueva in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2014, 04:43 AM
  2. excel 2003 open all excel in a specific folder.
    By Vagelisr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2013, 11:53 AM
  3. Search a word file in a specific folder and copy text to excel
    By corinereyes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2012, 08:15 AM
  4. [SOLVED] Open specific folder, select file to open and copy then paste
    By Kranky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-22-2012, 12:14 AM
  5. Open file into excel, copy certain cells, and paste them into a new worksheet.
    By dg980 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2011, 10:41 AM
  6. Replies: 1
    Last Post: 08-26-2005, 05:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1