#1
|
|||
|
|||
question about sorting
Hi folks, I am back again with another question for the excel gurus. I have attached a spreadsheet with 3 columns, its a song playlist and there is title, author, and comments in the 3 columns. As you can see, at the moment the songs are not sorted in alphabetical order. I want to sort these songs 2 ways, alphabetically by title, and alphabetically by author, and I want to sort them both ascending and descending. I know I can do this manually using the sort button, select column A or B and sort ascending or descending. That all works, but I want to be able to sort the entire songlist alphabetically, by just left clicking once on title or author, and them having excel sort my song list alphabetically a to z or z to a, based on whether I select title or author. I have seen many databases where this is done and there is an up/down arrow one selects to sort either ascending or descending, but I dont know how its done. Do I need to use a macro rather than formula(s)? Any suggestions? Many thanks
|
#2
|
|||
|
|||
Code:
Option Explicit Sub SortAlphabeticalA() Range("A3:A1000").Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlNo End Sub Sub SortAlphabeticalB() Range("B3:B1000").Sort Key1:=Range("B3"), Order1:=xlAscending, Header:=xlNo End Sub Sub SortAlphabeticalADwn() Range("A3:A1000").Sort Key1:=Range("A3"), Order1:=xlDescending, Header:=xlNo End Sub Sub SortAlphabeticalBDwn() Range("B3:B1000").Sort Key1:=Range("B3"), Order1:=xlDescending, Header:=xlNo End Sub |
#3
|
|||
|
|||
thanks for the quick reply, so it looks like I need to use code to do this rather than entering a formula in cells? But how do I get to the place in excel where I enter the code you providd? Thanks
|
#4
|
|||
|
|||
To enter code, Right Click on the sheet tab and select VIEW CODE.
The code is entered in the large window on the right hand side. You can add / select which module the code is entered into, by double clicking on the module name, on the left hand side. You can utilize the menu selections up top to create/insert a module. There are YouTube vids and there are other websites that teach how to use VBA code. |
#5
|
|||
|
|||
Thanks for the info, I will turen to google to try and find a crash course on VBA code. I will close the thread as solved. Thanks again
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Data Sorting Question | AQWst | Excel | 4 | 02-02-2015 11:37 AM |
Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question | rsrasc | Word VBA | 7 | 03-28-2014 12:28 PM |
Question about sorting paragraphs in Word 2007 | WaltR | Word | 5 | 02-21-2014 09:16 PM |
Sorting question | markg2 | Excel | 4 | 01-25-2010 03:13 PM |
Categories question & replying with attachment question | glitzymama | Outlook | 0 | 03-15-2006 09:32 AM |