Sort Multiple Sheets with Macro Loop

  • Hello All,

    I am trying to sort every worksheet that I have in a workbook with a few hundred sheets. Basically I want to filter every sheet descending based on the value in column B5 down. If I only had to do it once the process would be, apply filter across row 3 sort column B descending and then take off the filter.

    An example of the before would be Sheet1 and the after would be Sheet1 Result, Sheet2 and Sheet2 Result.

    I have attached an example file in the hopes that you can help.

    Thank you!

  • Re: Sort Multiple Sheets with Macro Loop

    Here is the code.let me know if it helps!

    Sub M()
        For Each ws In ActiveWorkbook.Worksheets
        ws.Range("B4", Range("B" & Rows.Count).End(xlUp).Address).Sort Key1:=[b4], _
        Order1:=xlDescending, Header:=xlYes
        Next ws
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!