# Please help me how can sort automatically in excel



## etheer (Jan 14, 2011)

Please help me what code vba can sort largest to smallest automatically every 15 seconds


----------



## sobeit (Nov 11, 2007)

see if the following helps

Is There A Way To Get Excel To Sort Data Every 30 Seconds | TheDailyReviewer


----------



## etheer (Jan 14, 2011)

i want sort largest to smallest automatically every 15 seconds


----------



## sobeit (Nov 11, 2007)

etheer said:


> i want sort largest to smallest automatically every 15 seconds


but you should be able to modify what I gave unless you are wanting someone to do all the work for you.


----------



## etheer (Jan 14, 2011)

you can give me code sort largest to smallest automatically every 15 seconds


----------



## etheer (Jan 14, 2011)

this code sort largest to smallest 
i want edit it sort largest to smallest automatically every 15 seconds 
plz help me

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+t
'
Range("O20").Select
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Add Key:=Range( _
"T2"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub


----------



## RSpecianjr (Jan 20, 2010)

Hey etheer,

As long as the code that you posted is what you want, this should run that code every 15 seconds.


```
Public whn As Double
Public Const T = 15
Sub SortA()
ColRange("O20").Select
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Add Key:=Range( _
"T2"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
StartTimer
End Sub
Sub StartTimer()
whn = Now + TimeSerial(0, 0, T)
Application.OnTime EarliestTime:=whn, Procedure:="SortA", Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=whn, Procedure:="SortA", Schedule:=False
End Sub
```
Regards,

Robert D. Specian Jr.


----------



## etheer (Jan 14, 2011)

RSpecianjr said:


> Hey etheer,
> 
> As long as the code that you posted is what you want, this should run that code every 15 seconds.
> 
> ...


 not work


----------



## etheer (Jan 14, 2011)

I want Column T Sorting largest to smallest automatically every 15 seconds


----------



## etheer (Jan 14, 2011)

*Please help me*


----------



## Glaswegian (Sep 16, 2005)

Hi etheer

I would ask you to bear a few things in mind here - everyone who offers help here is a volunteer, freely giving up spare time to help others. We all have normal lives to lead, families to attend to, work to be done. You have already received help - you cannot expect further replies every few minutes. Please be patient while waiting. Thanks.


----------



## RSpecianjr (Jan 20, 2010)

Hey Etheer,

You haven't really said much about what you are trying to do. You provided a macro, does that sort do what you want, just not ever 15 seconds?

If it doesn't, we need to know more specifics:

What is the range of your data?
Do you want to sort ONLY column T? If not what other columns do you need to sort with Column T?
Can you post an example workbook for us to work with, so we might be able to give suggestions?
What version of Excel are you using?

Regards,

Robert D. Specian Jr.


----------



## etheer (Jan 14, 2011)

Hey RSpecianjr
I used Microsoft Excel 2010
Now i used this code


Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+K
'
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Add Key:=Range( _
"T2"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub



Column T Sorting largest to smallest

I want edit it work automatically every 15 seconds


----------



## RSpecianjr (Jan 20, 2010)

Hey etheer,

If the code you posted does what you want it to, this should work for you:


```
Public whn As Double
Public Const T = 30
Sub SortA()

ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort.SortFields.Add Key:=Range( _
"T2"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("TDL").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

StartTimer
End Sub
Sub StartTimer()
whn = Now + TimeSerial(0, 0, T)
Application.OnTime EarliestTime:=whn, Procedure:="SortA", Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=whn, Procedure:="SortA", Schedule:=False
End Sub
```
If for some reason this isn't working for you, please be more specific as to what isn't working. 

Does it give you an error etc? 

Also:

What is the range of your data?
Do you want to sort ONLY column T? If not what other columns do you need to sort with Column T?
Can you post an example workbook for us to work with, so we might be able to give suggestions?

The questions we ask are not just trivial questions, it is so we can better help you.

Regards,

Robert


----------

