First thing you should do is get rid of all the unneeded activating and selecting.
For example, this gets rid of all the selecting/activating in the sub Two_Avg_Speed_Loop.
Sub Two_Avg_Speed_Loop()
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "*.CSV" Then
With ws
Set range1 = .Range("D:D")
Set range2 = .Range("O:O")
Set range3 = .Range("Q:Q")
Set range4 = .Range("S:S")
Set range5 = .Range("J:J")
.Range("N1") = WorksheetFunction.Average(range1)
.Range("O1:O3600").FormulaR1C1 = "=IF(RC[-11]="""","""",ABS(RC[-11]-R1C14))"
.Range("P1") = WorksheetFunction.Average(range2)
.Range("Q1:Q3600").FormulaR1C1 = "=IF(RC[-2]="""","""",(RC[-2]/R1C14))"
.Range("R1") = WorksheetFunction.Average(range3)
.Range("S1:S3600").FormulaR1C1 = "=IF(RC[-2]="""","""",ABS(1-RC[-2]))"
.Range("T1") = WorksheetFunction.Average(range4)
'percent green calculations
.Range("U1").Value = "1"
.Range("U2:U3600").FormulaR1C1 = "=IF(RC[-8]="""",R[-1]C,1+R[-1]C)"
.Range("V1:V3600").Fomula = "=D1"
.Range("W1").Value = "1"
.Range("W2:W20").FormulaR1C1 = "=R[-1]C+1"
.Range("X1:X3600").FormulaArray = _
"=MIN(IF((R1C21:R3600C21=RC[-1])*(R1C22:R3600C22<100),R1C22:R3600C22))"
.Range("Y1").FormulaR1C1 = "=COUNTA(C[-12])"
.Range("Z1").FormulaR1C1 = "=RC[-1]+1"
.Range("AA1:AA3600").FormulaR1C1 = "=IF(RC[-4]="""","""",IF(RC[-4]>R1C26,"""",RC[-4]))"
.Range("AB1:AB3600").FormulaR1C1 = "=IF(RC[-1]="""","""",RC[-4])"
.Range("AC1").FormulaR1C1 = "=COUNTIF(C[-1],0)"
.Range("AD1").FormulaR1C1 = "=RC[-5]-RC[-1]"
.Range("AE1").FormulaR1C1 = "=RC[-1]/RC[-6]"
.Range("AE1").NumberFormat = "0.00"
.Range("AF1") = WorksheetFunction.max(range5)
End With
End If
Next ws
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
That should speed things up a bit, but I'm sure there are other things that can help.
One thing I did notice was the array formula you are putting in 3,600 cells in column X, that's bound to take up some processing time.
PS You might consider turning off calculations when placing the formulas in the cells.
Bookmarks