+ Reply to Thread
Results 1 to 6 of 6

How to import specific columns from excel file

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Uberlandia Brazil
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to import specific columns from excel file

    Whats goin on Fellas?

    could anyone help me with a lil issue i'm having today.

    i'm trying to create a macro to import ESPECIFIC COLUMNS from an excel file. i was able to import the whole file but not just the columns.
    Funny though, eventhough the file i'm trying to import from has a .csv extension, it has an excel file format... but i could save it as and .xlsm extension.
    i only want to import columns D, F and K .

    here's the code i used. (if u guys find it easier to not use my code, thats fine!!!)

    Please Login or Register  to view this content.
    Thanx in advance fellas.
    Last edited by Leith Ross; 06-24-2013 at 03:05 PM. Reason: Added Code Tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to import specific columns from excel file

    Where are you importing the file to?

    PS Please add code tags.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    Uberlandia Brazil
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to import specific columns from excel file

    im importing to file to Access database table

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to import specific columns from excel file

    This question is in the Excel forum.

    If you are importing to Access you should get a text import wizard where you can select the which columns to import/skip.

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    Uberlandia Brazil
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to import specific columns from excel file

    i can't use the text import wizard because i need to use a button. So when the user clicks on the button the code behind should do the importation.
    so it needs to be in vba .

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to import specific columns from excel file

    Create a macro that does the import, convert it to VBA and change as necessary.

    Or simply use DoCmd.TransferSpreadsheet to import the entire sheet then execute, with code, a suitable make table query to create a new table with the required columns.

+ 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