+ Reply to Thread
Results 1 to 2 of 2

Continuously running a recorded macro-Please Help

  1. #1
    Registered User
    Join Date
    02-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Continuously running a recorded macro-Please Help

    Hi all....I intend to run the macro continuously either by creating a loop of macro or any other way of automatically sorting the columns continuously.....please help .....thanks in advance

    About macro-

    i have an excel macro which simply sorts few columns (numbers in descending and ascending manner) and assigned a button to run the macro.

    Few things...a) the excel is DDE linked so the the numbers are updated every second....
    b) this macro was recorded so i don't take any credits for the code. My understanding is of very basic level...


    I have given macro name"sortinoplusab" ....it sorts four columns- B (sort largest to smallest), Column AC- (sort smallest to largest , Column BI & CN both (sort largest to smallest)...the macro that was recorded is...




    Sub sortinoplusab()
    '
    ' sortinoplusab Macro
    '

    '
    Range("B3").Select
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Add Key:=Range("B3"), _
    SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sortino").Sort
    .SetRange Range("A3:X228")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("AC3").Select
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Add Key:=Range("AC3"), _
    SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sortino").Sort
    .SetRange Range("AB3:AY228")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("BI3").Select
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Add Key:=Range("BI3"), _
    SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sortino").Sort
    .SetRange Range("BB3:BV203")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("CN3").Select
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sortino").Sort.SortFields.Add Key:=Range("CN3"), _
    SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sortino").Sort
    .SetRange Range("BX3:CN203")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("CV18").Select
    End Sub

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Continuously running a recorded macro-Please Help

    Please in future place your code within code tags - read the forum rules that explains how to use the code tags and our forum rules.

    Place this code into a module and run the macro called runSort - it will run the sort every 1 second continuously until you close the workbook.
    Please Login or Register  to view this content.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1