+ Reply to Thread
Results 1 to 7 of 7

Import worksheet from user selected file into open workbook

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Import worksheet from user selected file into open workbook

    I need to import a worksheet named "Serial Numbers" from a user selected workbook ( I would assume using GetOpenFilename?) and add that sheet to an open workbook. Also need to make sure the imported sheet is named "Serial Numbers". Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Import worksheet from user selected file into open workbook

    This seems like it covers all the bases:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 09-14-2012 at 11:15 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-12-2012
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Import worksheet from user selected file into open workbook

    A couple of errors. In the file open dialog box, no files show up even though the file I want to import is an excel file (version Excel 97-2003 format). I can select all files and then I can see the file I want to import. When I select the file, I get the message box stating that the Serial Number Sheet was not found in that workbook, but that sheet does exist in the import file.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Import worksheet from user selected file into open workbook

    I've highlighted the "default search" line of code in the macro above. Do spend time reading through the macro line by line so you can suss what each thing does. I'd expect you could spot that line of code and edit it if you really looked.

    The macro is using specific sheet names, so any hidden spaces or such would cause it to not find it. I'd be happy to look at one of your source files if you care to upload, just to be sure.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

  5. #5
    Registered User
    Join Date
    09-12-2012
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Import worksheet from user selected file into open workbook

    After goofing around, this worked:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Import worksheet from user selected file into open workbook

    Ah, so the sheets were actually called Srial Numbers and no Serial Numbers? Goofing around is the All-American method of learning, works for me!

    Cheers.

  7. #7
    Registered User
    Join Date
    09-12-2012
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Import worksheet from user selected file into open workbook

    One of the many faux pas I committed while trying to do this. That and fat fingers! Thanks for you help. Much appreciated!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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