Macro to sort descend on a timed basis

graemeal

Active Member
Joined
May 17, 2007
Messages
316
Platform
  1. Windows
I need to "sort descending" a column constantly throughout the day (G2:G1950) up to 100 times daily. I have set up a macro so all I do now is press ctr then q to "sort descending"

Is there a way that I can "sort descending" automatically every minute or preferably ever 30 seconds so i don't have to press buttons. I am studying VBA at present but seems the "time thing" is the problem so not easy?????

Cheers

Graeme
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
first create a mcaro for your work
then try the following macros

my noes gives instructions as follows
quote
first run start timer the procedure "the-sub" will start runing after 10 second and run every five seconds.
If you want to stop then run the macro "stop timer"
unquote
in the macro called "the_sub" some trivial example of code statements are given . you replace them by the statemtns in the macro you have created.
this solution was given by Ron de Bruin.

try in ggogle search "ron de brin" to get the thread.

the above is given from my notes. I have not checked

the macros are

Code:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 10
Public Const cRunWhat = "The_Sub"

Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, 5)
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
     schedule:=True
End Sub

Sub The_Sub()
'MsgBox ""
 Dim dest As Range
     'MsgBox Target.Address
    
    
    Set dest = Cells(Rows.Count, "D").End(xlUp).Offset(1, 0)
    Range("B1:B6").Copy dest
    Application.CutCopyMode = False
line1: StartTimer
End Sub

Sub StopTimer()

   On Error Resume Next
   Application.OnTime earliesttime:=RunWhen, _
       procedure:=cRunWhat, schedule:=False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,334
Members
448,956
Latest member
Adamsxl

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