Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2024, 11:00 PM
oscarlimerick oscarlimerick is offline question about sorting Windows 8 question about sorting Office 2013
Advanced Beginner
question about sorting
 
Join Date: Jul 2020
Posts: 57
oscarlimerick is on a distinguished road
Default 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
Attached Files
File Type: xlsx example for excel forum.xlsx (9.3 KB, 2 views)
Reply With Quote
  #2  
Old 01-18-2024, 01:28 AM
Logit Logit is offline question about sorting Windows 10 question about sorting Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

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
Attached Files
File Type: xlsm example for excel forum.xlsm (16.2 KB, 2 views)
Reply With Quote
  #3  
Old 01-18-2024, 09:28 AM
oscarlimerick oscarlimerick is offline question about sorting Windows 8 question about sorting Office 2013
Advanced Beginner
question about sorting
 
Join Date: Jul 2020
Posts: 57
oscarlimerick is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 01-18-2024, 11:42 AM
Logit Logit is offline question about sorting Windows 10 question about sorting Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

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.
Reply With Quote
  #5  
Old 01-18-2024, 07:00 PM
oscarlimerick oscarlimerick is offline question about sorting Windows 8 question about sorting Office 2013
Advanced Beginner
question about sorting
 
Join Date: Jul 2020
Posts: 57
oscarlimerick is on a distinguished road
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
question about sorting Data Sorting Question AQWst Excel 4 02-02-2015 11:37 AM
question about sorting 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
question about sorting 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft