ProphetofProfit
New Member
- Joined
- Feb 28, 2011
- Messages
- 28
IF THEN is the problem, I don't know why. I'm not a professional coder, I just do this stuff for the thrills . I'm trying to find the value of Sheets("Odds").Cells(r, 18).Value in the sheet "Get Odds" and then copy the two cells to the right back into "Odds".
You can see that I'm running another macro in this macro, which outputs the cells which I need to copy and paste. This other macro takes about 5 seconds to complete, will my macro automatically give this "Cmdcalculate_click" macro enough time to finish?
------------------------
Sub BackTest()
Dim i
Dim r
For r = Sheets("Summary").Range("E1") To Sheets("Odds").Range("E2")
'Copy predicted goals to "Get Odds"
Sheets("Get Odds").Cells(1, 3).Value = Sheets("Odds").Cells(r, 7).Value
Sheets("Get Odds").Cells(2, 3).Value = Sheets("Odds").Cells(r, 8).Value
'Run Macro
Application.Run "CmdCalculate_Click"
'Copy over and under 2.5 probabilities
Sheets("Odds").Cells(r, 11).Value = Sheets("Get Odds").Range("B19").Value
Sheets("Odds").Cells(r, 12).Value = Sheets("Get Odds").Range("B20").Value
'Search for the asian handicap in "Get Odds"
For i = Sheets("Get Odds").Range("A32") To Sheets("Get Odds").Range("A56")
If
Sheets("Get Odds").Cells(i, 1).Value = Sheets("Odds").Cells(r, 18).Value
Then
Sheets("Odds").Cells(r, 21).Value = Sheets("Get Odds").Cells(i, 2).Value
Sheets("Odds").Cells(r, 22).Value = Sheets("Get Odds").Cells(i, 3).Value
Else
Next i
Next r
End Sub
--------------------
You can see that I'm running another macro in this macro, which outputs the cells which I need to copy and paste. This other macro takes about 5 seconds to complete, will my macro automatically give this "Cmdcalculate_click" macro enough time to finish?
------------------------
Sub BackTest()
Dim i
Dim r
For r = Sheets("Summary").Range("E1") To Sheets("Odds").Range("E2")
'Copy predicted goals to "Get Odds"
Sheets("Get Odds").Cells(1, 3).Value = Sheets("Odds").Cells(r, 7).Value
Sheets("Get Odds").Cells(2, 3).Value = Sheets("Odds").Cells(r, 8).Value
'Run Macro
Application.Run "CmdCalculate_Click"
'Copy over and under 2.5 probabilities
Sheets("Odds").Cells(r, 11).Value = Sheets("Get Odds").Range("B19").Value
Sheets("Odds").Cells(r, 12).Value = Sheets("Get Odds").Range("B20").Value
'Search for the asian handicap in "Get Odds"
For i = Sheets("Get Odds").Range("A32") To Sheets("Get Odds").Range("A56")
If
Sheets("Get Odds").Cells(i, 1).Value = Sheets("Odds").Cells(r, 18).Value
Then
Sheets("Odds").Cells(r, 21).Value = Sheets("Get Odds").Cells(i, 2).Value
Sheets("Odds").Cells(r, 22).Value = Sheets("Get Odds").Cells(i, 3).Value
Else
Next i
Next r
End Sub
--------------------