DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: macro to alphabetizing tables in a worksheet.

  1. #1
    Join Date
    Jul 2008
    Posts
    8

    macro to alphabetizing tables in a worksheet.

    Hi guys, thanks so much for taking a moment to look at this thread and to try and help me out. I've been pretty amazed on how welcoming and supportive these forums are!! So, here's my coding problem.

    BACKGROUND
    In excel, I'm creating an ouptput file containing a summary of information for a group of companies. for each company there is a "template table" in the spreadsheet. The user enters data in an input document for the companies and then activates a macro which updates the summary file with the relevant information. the known companies are listed and updated, and new companies will be added to the input spreadsheet with the needed info for the new companies added to the summary file.


    THE GOAL
    i've created a macro to update the summary file when the user enters company names that are present in the summary file. When the user adds a new company to the input file, a new "template table" needs to be added to the summary file. The "template table" needs to be in alphabetical order relative to the other companies.

    WHERE I AM ASKING FOR HELP
    I can figure out a way to add the new companies and a cooresponding "template table" to the summary file while preserving the
    alphabetical order realtive to the companies. This last part is key. I can import the summary info based on the previous macro.


    Thanks so much for helping me out! Hopefully I'll be able to return the favor!

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    So, is all you need to do is sort a particular column in a spreadsheet?

    Is that, fundamentally, the bottom line here?

  3. #3
    Join Date
    Jul 2008
    Posts
    8
    Yes!!! when the user adds a new company name to the input file, that company needs to go in the right alphabetical order in the output file while not effecting the exixting "tmplate tables"

    EDIT- Here is a mini- output file. Imagine the user wanted to add a company named candy to the output.


    Thanks again Hack!
    Attached Files Attached Files
    Last edited by jaya_acra; 07-10-2008 at 03:07 PM.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    First, add a new company to the input file.

    Next, start recording a macro.

    Manually go through the steps to sort the column holding the company names.

    Stop the macro recording.

    There is the code you need to perform that task automatically.

  5. #5
    Join Date
    Jul 2008
    Posts
    8
    Thanks for your help Hack! I tried sorting the coloumns after getting a new company name,but the company template tables get affected. for example, in the example ouput file if i try to add a new company aaa then do a sort, the company names are then sorted then i lose the tables get messed up

    I can feel my hair turning gray as we speak

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    What do you mean you "lose the tables?"

  7. #7
    Join Date
    Jul 2008
    Posts
    8
    Hey Hack, thanks so muchj for trying to help me. The file "initial" is what the summary file looks like initially, and the file "after sort" shows what it looks like after doing a straight up sort on the supplier column. it alphabatizes the rows, but i lose the table templates .
    Attached Images Attached Images

  8. #8
    Join Date
    Jul 2008
    Posts
    8
    Would it be possible for someone to help me with this? I don't have anyone here at this office to ask for help...

    Much appreciated :-/

Similar Threads

  1. Re: (No subject)
    By Joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 06:13 PM
  2. Replies: 16
    Last Post: 10-22-2002, 09:01 AM
  3. Replies: 0
    Last Post: 04-02-2002, 03:13 PM
  4. Replies: 1
    Last Post: 03-26-2002, 09:36 AM
  5. Replies: 5
    Last Post: 05-25-2000, 02:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center