+ Reply to Thread
Results 1 to 9 of 9

Auto Sort Alphabetically

  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    24

    Auto Sort Alphabetically

    Hi,

    is it possible to auto sort data using VB script?

    as i know i can manually do it but i would like to run a script to sort data on sheet 2


    Steve.
    Last edited by gadjit; 09-16-2009 at 12:21 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Auto Sort Alphabetically

    You could try recording a macro for this to get the basic code then post it on the forum for help in optimizing it.

  3. #3
    Registered User
    Join Date
    04-22-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Auto Sort Alphabetically

    Thanks Palmetto for the advice i forgot some things are so simple.

    just change the Range("A2:E651") part of the code to suit your needs.


    Please Login or Register  to view this content.

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Auto Sort Alphabetically

    If your data range is expected to increase in size then you will want your code to be able to accomodate the change.

    This code will find the number of used rows going down column-A and the numnber of used columns goind across row 1 and set the sort range accordingly. Starting row and sort key are based on your code.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Auto Sort Alphabetically

    I have a list of clients that I would automatically want to sort when I run a macro to add to the list. Now what happens is the addition is added to the bottom of the list. I must manually do a sort by alpha order. I would like to when I add to the list it also runs a macro to put the addition in order (by the column A.......the list has up to J column with address, telephone, fax etc

    can you help me please?

    ---------- Post added at 04:58 PM ---------- Previous post was at 04:55 PM ----------

    I will try that Palmetto....thanks

    ---------- Post added at 05:05 PM ---------- Previous post was at 04:58 PM ----------

    Wow....i think it works.......im doing a test

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Auto Sort Alphabetically

    @Davesedgwick
    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

    Please note that this thread is 3 yrs old.
    Ben Van Johnson

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Auto Sort Alphabetically

    It seems to work well......how can I run this macro automaticcaly when I run the macro to add the client to my list? can I have it do both add and then sort?

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Auto Sort Alphabetically

    Hello Davesedgwick, and welcome to the forum.

    Unfortunately you have inadvertently broken two of the forum rules. Please read the following and make the necessary change. Thanks.

    1. As pointed out by protonLeah in post #6

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

    2. By ignoring post #6

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

  9. #9
    Registered User
    Join Date
    08-01-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Auto Sort Alphabetically

    so sorry....not sure how this works yet....sorry if I have broken a rule

+ 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