+ Reply to Thread
Results 1 to 8 of 8

Import Specific Sheet into Workbook with VBA

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007/10
    Posts
    43

    Import Specific Sheet into Workbook with VBA

    Hi all,

    I am working creating an excel tool, and part of it involves importing a sheet from one workbook into another. However, I want it to be dynamic so that the name of the sheet doesn't have to be the same.

    Right now I have the following code that imports the sheet named "Import"
    Please Login or Register  to view this content.
    Is there a way to display what sheet names exist within the workbook that you want to import from, and then allow the user to select which they would like? (As is possible when importing excel data into access)

    Any help or suggestions would be appreciated, thanks!
    Last edited by chicagoland8; 09-18-2014 at 11:13 AM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Import Specific Sheet into Workbook with VBA

    Untested see if this helps?

    Please Login or Register  to view this content.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Import Specific Sheet into Workbook with VBA

    Hi chicagoland8

    Add a UserForm with a ListBox to Wb1. Place this Code in the UserForm Code Module
    Please Login or Register  to view this content.
    Replace your "Import" Code with this
    Please Login or Register  to view this content.
    Sample attached...
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    10-04-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007/10
    Posts
    43

    Re: Import Specific Sheet into Workbook with VBA

    Looks to be exactly what I needed, thanks!

  5. #5
    Registered User
    Join Date
    10-04-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007/10
    Posts
    43

    Re: Import Specific Sheet into Workbook with VBA

    Quick question jaslake--

    Is there a way to make it so that you can click your selection and then hit "okay" before it actually imports? That way a mis-click won't import the wrong sheet.

    Not a big deal at all if not, but I figured it can't hurt to ask!

    Thanks again for the help!!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Import Specific Sheet into Workbook with VBA

    Hi Chicago

    Sure, add an import Button to the UserForm. Your UserForm Code will look something like this
    Please Login or Register  to view this content.
    I'd recommend you do some error checking to make certain a Worksheet was selected from the ListBox.

  7. #7
    Registered User
    Join Date
    10-04-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007/10
    Posts
    43

    Re: Import Specific Sheet into Workbook with VBA

    Thanks again!!

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Import Specific Sheet into Workbook with VBA

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. Import specific data from one workbook another!
    By iluvfnky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2014, 09:54 AM
  2. Import specific sheet with name and Date mm/dd/yyyy from closed workbook
    By frank35 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2013, 11:21 AM
  3. How to import excel specific data to a new workbook
    By GEMINI528 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2013, 02:35 PM
  4. [SOLVED] Import from 2nd workbook to specific worksheet
    By ERoemer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2013, 03:15 PM
  5. Replies: 2
    Last Post: 11-17-2010, 11:39 AM

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