PDA

View Full Version : Automatic data sort



K. Georgiadis
09-15-2006, 07:19 AM
I have a data table in range A9:C82 (no headings) in worksheet "Profit Contribution" and I would like the data table to be sorted for column C in descending order each time the worksheet is opened. How do I code that?

Thanks in advance!

Bob Phillips
09-15-2006, 07:32 AM
Private Sub Worksheet_Activate()
Me.Range("A9:C82").Sort key1:=Me.Range("C1"), order1:=xlDescending, header:=xlNo
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

K. Georgiadis
09-15-2006, 07:40 AM
Terrific! Thanks a bunch.