+ Reply to Thread
Results 1 to 5 of 5

Scan through cells, and distribute to appropriate alpha sheets

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    ND
    MS-Off Ver
    Excel 2003
    Posts
    8

    Scan through cells, and distribute to appropriate alpha sheets

    Hello,

    I have a sheet that contains several thousand rows, each with 14 columns or so. I would like to have VBA scan the first char. of each cell in column C(some begin with text, some #'s) and sort them out to corresponding sheets alphabetically.
    So if cell C3 said "SINA BERG", the entire row would be CUT and pasted into a sheet named "S". Cell C4, "SINA BERG2" would go into "S" also, but not overwrite the first entry. Cells beginning with numbers would go into a sheet named "#s".
    If I could get code for it to actually work and just a couple of sheets then I can do the rest and I would be very grateful.

    Thank you.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Scan through cells, and distribute to appropriate alpha sheets

    I’m assuming you have 28 sheets, one called “source” which you want to copy from, 26 named for each letter of the alphabet (A-Z) and one named '#s' for numbers

    If so, try this code (note it will return an error if a cell in column “C” begins with a letter that is not also the name of a sheet).

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-16-2011
    Location
    ND
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Scan through cells, and distribute to appropriate alpha sheets

    Thank you for the quick reply!
    It works nearly flawlessly and exactly what I was aiming for. The only thing I am curious about is after I run the script if I were to delete, say, the first three rows in sheet "A", then re-run the script, I would like it to dump the results in the first row, instead it puts the new results in the fourth row, fifth row, etc. even though there is blank space above it.

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Scan through cells, and distribute to appropriate alpha sheets

    If you want it to copy the row from the source sheet to the first blank row in the destination sheet, rather than after the last used cell, try this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-16-2011
    Location
    ND
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Scan through cells, and distribute to appropriate alpha sheets

    Thanks so much! What if I wanted to move the moved rows in the new sheet over a column or two?

+ 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