+ Reply to Thread
Results 1 to 3 of 3

VBA Code to sort in ascending AND descending order

  1. #1
    Registered User
    Join Date
    06-06-2017
    Location
    Markham, ON
    MS-Off Ver
    2013
    Posts
    8

    VBA Code to sort in ascending AND descending order

    Hey guys,

    I want to make a ActiveX button with VBA code that does a sort on the second click.
    For example, on the first click it sorts the data in ascending order; on the second click, it sorts it in descending order and so on.
    Here is my existing code below for one of the columns I have a button for (right now, it obviously only does it in ascending order).

    Please Login or Register  to view this content.
    How would I modify this to get it to sort ascending AND descending?

    Thank you,

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,301

    Re: VBA Code to sort in ascending AND descending order

    That wasn't working code - x1No is not an accepted value xlNo is, though:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-06-2017
    Location
    Markham, ON
    MS-Off Ver
    2013
    Posts
    8

    Re: VBA Code to sort in ascending AND descending order

    Quote Originally Posted by Bernie Deitrick View Post
    That wasn't working code - x1No is not an accepted value xlNo is, though:

    Please Login or Register  to view this content.
    Thank you for noticing that typo.

    EDIT: Never Mind, It is now working! Thank you so much Bernie!
    Last edited by infinitecables; 06-07-2017 at 11:18 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Code For Sort out By Ascending Order
    By pvsvprasad in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-07-2016, 09:53 AM
  2. [SOLVED] any way to arrange the categories on a bar chart by ascending/descending order
    By tukae in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-26-2015, 08:01 AM
  3. VB Code to sort the list in ascending order
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2015, 12:08 PM
  4. macro to sort in ascending/descending order
    By apio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2012, 02:46 AM
  5. Can you sort a chart out in Ascending/Descending Order
    By dandavis1 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 11-26-2010, 09:52 AM
  6. one macro to sort text in ascending and descending order
    By jpruffle in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-13-2008, 10:24 PM
  7. Sorting Numbers in Ascending or Descending Order
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-28-2005, 11:25 AM

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