Hello everyone,
I've recorded a macro to automate a fairly simple sorting action, however it still takes a long time to process it due to the dimension of the data.
Is there a way to optimize the following code or is it likely to be due to the amount of data of the spreadsheet?
Happy to provide a small spreadsheet as example if necessary. Might just be due to all the data anyway but I thought in asking just in case.
Thanks!
I've recorded a macro to automate a fairly simple sorting action, however it still takes a long time to process it due to the dimension of the data.
Is there a way to optimize the following code or is it likely to be due to the amount of data of the spreadsheet?
VBA Code:
Sheets("Summary").Select
Range("C25").Select
Range(Selection, Selection.End(xlDown)).Select
Range("C25:O5259").Select
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add(Range("C25:C5259"), _
xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(112, 48 _
, 160)
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add(Range("C25:C5259"), _
xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(192, 0 _
, 0)
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add(Range("C25:C5259"), _
xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255, _
199, 206)
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("C25:O5259")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Happy to provide a small spreadsheet as example if necessary. Might just be due to all the data anyway but I thought in asking just in case.
Thanks!