Finance

Charts

Statistics

Macros

Search

Sorting All Columns of a List with Excel VBA

In Microsoft Office Excel 2010, by using the Sort dialog box, you can specify in sequence how and by which columns the data should be sorted. However, if you need to sort the entire list in ascending or descending order, taking into account all the columns that belong to the list, follow the example below.

  • First, place a list with data on the worksheet. For example, let’s again use our list of car owners.
  • Add two CommandButton controls. The first button will perform ascending sorting for all columns of the list, and the second button will perform descending sorting.

  • Change the Caption property values of the buttons respectively to:
    • SORT ASCENDING FOR ALL COLUMNS
    • SORT DESCENDING FOR ALL COLUMNS
  • Add the program code that performs the sorting to a standard module, and the program code that handles the button clicks to the Sheet1 module.
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx