Auto sort?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
921
Office Version
  1. 365
  2. 2019
I have a worksheet called “Drivers & Standings” with data from A1 through AB18. All of the data on this worksheet is pulled from other worksheets – there is no manual entry on this one. When the other worksheets are updated with information used by this one, I’d like this one to automatically sort on column X. However, column A must not be included in the sort (it is static). Row 1 is the header row, but there is also a hidden row 2 that should not be included in the sort.

Any help would be greatly appreciated.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Can you run a macro on it that will auto sort it? You select all the cells that should be sorted, Say B1 : AB200. Then go to sort and make sure you select that your data has headers. Then just make the header also include the hidden row 2.

Would that worrk?
 
Upvote 0
Can you run a macro on it that will auto sort it? You select all the cells that should be sorted, Say B1 : AB200. Then go to sort and make sure you select that your data has headers. Then just make the header also include the hidden row 2.

Would that worrk?

Before I try this, and I think creating the macro would be easy enough, how do I make it run automatically? Like upon entering the worksheet for instance?
 
Upvote 0
Anyone? I feel like there must be some VB code that would do this? Thanks
 
Upvote 0
Try this: right click the Drivers & Standings tab, select View Code and paste in

Code:
Private Sub Worksheet_Activate()
Range("B3:AB18").Sort Key1:=Range("X3"), Order1:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
 
Upvote 0
Try this: right click the Drivers & Standings tab, select View Code and paste in

Code:
Private Sub Worksheet_Activate()
Range("B3:AB18").Sort Key1:=Range("X3"), Order1:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Excellent, thanks!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top