+ Reply to Thread
Results 1 to 4 of 4

Macro to import data from folder without hardcoding any file name

  1. #1
    Registered User
    Join Date
    03-21-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    Macro to import data from folder without hardcoding any file name

    Hi All,

    I'm looking for a macro to import data from excel sheet.when i click on command button in sheet1 it will go to Folder C:\ once i select the input excel file it will copy the excel sheet data into sheet2 of my macro sheet.Any one can guide me.

    File name can not be hardcoded.
    Thanks

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Macro to import data from folder without hardcoding any file name

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    03-21-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    Re: Macro to import data from folder without hardcoding any file name

    Hi Bernie Deitrick,
    Thanks for your script.Only one issue is when i ran macro it is opening c folder. instead of selecting file when i click cancel buttonn im getting runtime error 1004.false.xlsx not found instead of getting that runtime error is there any way to avoid that error by using any error handling or when i click cancel it will not throw any error.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Macro to import data from folder without hardcoding any file name

    Did you not want to "go to Folder C:\ "? Anyway, this will handle the cancel error - not running the code when you don't want to import the sheet will also prevent the error.

    Please Login or Register  to view this content.

+ 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. [SOLVED] Import data from files in folder with a given word/text in the file name
    By runnerD2016 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2016, 11:20 AM
  2. VBA to import data from a file within current folder
    By volvodriver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2016, 09:56 AM
  3. Macro to find most recent csv file in folder and import this
    By electros in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-08-2015, 04:25 AM
  4. Macro to import data from folder
    By toravietl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2014, 06:25 AM
  5. [SOLVED] Macro - Master file to import data from another open file with variable file name
    By jdodz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2012, 10:56 PM
  6. Replies: 2
    Last Post: 08-05-2012, 02:58 PM
  7. Replies: 17
    Last Post: 12-06-2011, 11:50 AM

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