Hi,
I have pretty basic skills so wondered if anyone could help me please. I have written/recorded the following macro:
Application.Calculate
Sheets("Table").Range("K3:P26").Select
Selection.Copy
Sheets("Table").Range("R3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _
:=False, Transpose:=False
'Sheets("Table").Range("K3:P26").Select
'Application.CutCopyMode = False
'Selection.Copy
Sheets("Table").Range("Y3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Add Key:=Range("AD3:AD26") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Add Key:=Range("AC3:AC26") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Add Key:=Range("AA3:AA26") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Add Key:=Range("Y3:Y26"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Table").Sort
.SetRange Range("Y2:AD26")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("Table").Range("Y3:Y26").Select
Selection.Copy
Sheets("Table").Cells(58 + i_paste, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
'Range("c55") = Range("C55") + 1
End Sub
Although this works fine for it's intended purpose it is very slow to run (I am looping this macro thousands of times). I have tried cleaning up areas of it where I could but wondered if there was a way of coding this that would help it to run quicker.
Many thanks in advance for any help!
Bookmarks