beetonthebrat
New Member
- Joined
- Oct 28, 2016
- Messages
- 4
I'm trying to speed up my code. I understand there are many, MANY combinations that I'm looping through but want to know if there's anything I can do to help.
I would think using VBA for calculating instead of spreadsheets and the evaluate function would make this go very quickly but it's been running for hours. Any help would be appreciated.
Code:
Sub casey()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Dim a, b, c, d, e, f, g, h, i As Integer
For a = 1 To 500
For b = 1 To 500
For c = 1 To 500
For d = 1 To 500
For e = 1 To 500
For f = 1 To 500
For g = 1 To 500
For h = 1 To 500
For i = 1 To 500
a:
If Evaluate(a + b - c) = Evaluate(d ^ 2 + e - f) And Evaluate(d ^ 2 + e - f) = Evaluate(g + h + i) Then
Exit Sub
End If
DoEvents
Next i
Next h
Next g
Next f
Next e
Next d
Next c
Next b
Next a
GoTo a
End Sub
I would think using VBA for calculating instead of spreadsheets and the evaluate function would make this go very quickly but it's been running for hours. Any help would be appreciated.