+ Reply to Thread
Results 1 to 2 of 2

make every column a new sheet and then import each as a separate table in Access

  1. #1
    Registered User
    Join Date
    08-07-2011
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    1

    make every column a new sheet and then import each as a separate table in Access

    Hello All,

    I have been using my primitive knowledge to try and figure this out for a while and someone directed me here for help. Please help if you can. I'd like to be able to write a macro that does the following.

    Saves every column of an Excel sheet as a new sheet (or perhaps a new book), but recopying the first column every time. So sheet2 will have columns 1&2, sheet 3 has columns 1&3, and so on.

    Then (perhaps separate macro) imports each new sheet into Access as a separate table.

    Reasons:
    I have to split it up in excel first because my spreadsheets have ridiculously large numbers of characters in some cells (don't ask) and access has a limit on how many characters can imported in the row of an imported table.

    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: make every column a new sheet and then import each as a separate table in Access

    This is a little more versatile than you described, but it makes the macro work in any scenario you have like this.

    The macro will:

    1) ...Ask you to enter the first column NUMBER that is a data column. In your scenario, that would be column 2 (column B). All columns to the left of the number you enter will appear on every sheet created.

    2) ...ask you how many data columns to put on each sheet. In your scenario, that would be 1 data column per sheet, but you might have other situations where you wanted data in column groups of 2 or more... this will handle that, too.

    3) ...create a new sheet for each column group with the primary columns duplicated on each sheet.

    Please Login or Register  to view this content.
    Also published at:
    Last edited by JBeaucaire; 08-07-2011 at 04:04 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!)

+ 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