I have some code to sort all sheets column E low to high. I have 18 sheets each with about a million rows. I can sort one sheet manually and it takes maybe 5 seconds. When I use this code, the 18 sheets take almost 10 min.
I will have any number sheets, depending on previous calculations. In this instance, it is 18.
Also, it takes way more memory than I would expect.
Thanks for any help![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)
I will have any number sheets, depending on previous calculations. In this instance, it is 18.
Also, it takes way more memory than I would expect.
Thanks for any help
![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)
Code:
Sub SortAllSheets()
'Descending sort on A:E using column E, all sheets in workbook
Dim ws As Worksheet
For Each ws In Worksheets
ws.Columns("A:E").Sort Key1:=ws.Columns("E"), Order1:=xlAscending
Next ws
End Sub