+ Reply to Thread
Results 1 to 6 of 6

Auto sort excel table in VB

  1. #1
    Registered User
    Join Date
    09-08-2012
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Auto sort excel table in VB

    I'm trying to auto sort a table in excel. I want to have the table in "Summary" sheet automatically sort when a cell is changed in column A. I also want the numbers in the sort to be sorted last so that the text is first in the list.

    I've attached the file I'm working on. I copied a macro to auto sort in VB but it does not work right. The cells in column A refers to another cell. When I change the value in the other cells the table will not sort. I also get an error message when i open the file now.

    Can anyone help?
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Auto sort excel table in VB

    I don't know how you change the value in Protected sheet though.

    To Summary sheet module
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-08-2012
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Auto sort excel table in VB

    This works perfect! Thank you.

    The cell values in column A come from other sheets. This is why it's locked and protected and how the values are changed.

  4. #4
    Registered User
    Join Date
    09-08-2012
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Auto sort excel table in VB

    I spoke too soon. The problem is when I change a Sheet name from a number to a Text I get the error "#value!". It looks to me the module it refers to cell "C3" as a number. So this adds a "+0" to my formula in the C3 cell.

    Any suggestions?

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Auto sort excel table in VB

    Try replace following part in "mySort" sub procedure
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-08-2012
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Auto sort excel table in VB

    That seems to work.

    Thank you.

+ 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