+ Reply to Thread
Results 1 to 6 of 6

Arrange Cells(and Corressponding Details) According To Alphabetical Order

  1. #1
    Registered User
    Join Date
    06-14-2007
    Posts
    25

    Arrange Cells(and Corressponding Details) According To Alphabetical Order

    am creating this forms where by entires are updated on another spreadsheet.
    once it is updated, a new row will form, and the information will be updated on it.

    however there is a problem, the info are not in alphabetical order.

    hence is there a way to create a button on this spread sheet such that it will arrange the column of details in alphabetical order?

  2. #2
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    kaisin,

    This little bit of code will sort everything in Col A alphabetically and could be attached to a button or incorporated as part of your other code. Maybe this will help you get started.
    Please Login or Register  to view this content.
    Sincerely,
    Jeff

  3. #3
    Registered User
    Join Date
    06-14-2007
    Posts
    25
    hi! thaks for the prompt reply but it cant really work..

    here's more details.

    the button is called : " Button 3"

    the columns b and c are together as one column is "name" and the other column is "age", such that when we click the button, all the names will run alphabetical and they will still be with their corressponding age. The columns are column b and column c



    2. i still have 2 column at F & G. can they be arranged also at the hit of the same button or do i have to create another button


    help~~~

  4. #4
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    kaisin,

    Give this a try

    Please Login or Register  to view this content.
    In this section of code
    Please Login or Register  to view this content.
    the "A:E" represents all of the columns you want to stay together when the sort is performed. Therefore you will need to change this to whatever fits. Personally, I would include all the columns that contain data.

    This section of code
    Please Login or Register  to view this content.
    indicates what column you want the sort keyed on.

    As for your button. It should be a button that is created via the Forms task bar. These buttons can have macros attached. All you do is right click on the button and select Assign Macro. A list of macros will appear and you just click the one that contains the above code.

    You did not mention what your VBA skill level is so I don't know if I have provided enough information or not. Let me know and I will try to keep helping until your problem is resolved. I also do not know what your location is so I am not sure of our time difference as far as communicating back and forth. There could be a big delay if you are in China or Australia.
    Last edited by boylejob; 07-06-2007 at 12:09 PM.

  5. #5
    Registered User
    Join Date
    06-14-2007
    Posts
    25
    hi, thanks for the reply. I am from singapore so there shud be a big time difference but its ok.

    I have added the script into the program and there is one error in the code below

    Set wsSht1 = Sheets("Sheet2")

    i am using the button on Sheet 2(named it as Sheet B)
    Attached Files Attached Files

  6. #6
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    kaisin,

    Replace the old code with this and it should work fine.
    Please Login or Register  to view this content.
    This takes into account that your button is on Sheet B and that you have a header row.

    Are you also wanting to sort the other columns F and G. If so, are you wanting to do it at the same time you sort the other two columns. If you are, use this code
    Please Login or Register  to view this content.
    Hope all this works on your end.

+ 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