How can I set up Excel to auto-sort each column independently?
G'day
Try this:
Open the Visual Basic Window
Put this in the "Workbook" section of your spreadsheet
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.OnTime Now + TimeValue("00:30:00"), "AutoSort"
End Sub
Every 30 mins it will "AutoSort" the range you have selected.
Create a Module in the Visual Basic Window.
Call it "AutoSort"
Sub AutoSort()
Range("YourStartRange:YourEndRange").Select
ActiveWorkbook.Worksheets("YourSheetName").Sort.So rtFields.Clear
ActiveWorkbook.Worksheets("YourSheetName").Sort.So rtFields.Add
Key:=Range("YourStartRange:YourEndRange"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("YourSheetName").Sort
.SetRange Range("YourStartRange:YourEndRange")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
The (Add Key:=Range) is the column which you want to sort.
You can also place a macro button on your spreadsheet so that you can
manually trigger the sort.
HTH
Mark
|