Folks, in plain English right quick, here is what I am DOING and then I'll show the vba code for it:
I have a Range from N2:AE2 > I want vba to autofill the forumulas in that range all the way down from 2 to row 198
Caveat, it is web scraping so it needs to autofill N rows every N seconds. I wrote the script in NON-LOOP format as such:
QUESTION: How can I make this autofill every 10 rows per 12 seconds a LOOP with the ability to easily change (for optimizing the scrape [im using the smf excel add in by the way with its 'rchgettablecells' formula contained in each cell of the range]) those per row and per second parameters?
Thank you!
Tom
I have a Range from N2:AE2 > I want vba to autofill the forumulas in that range all the way down from 2 to row 198
Caveat, it is web scraping so it needs to autofill N rows every N seconds. I wrote the script in NON-LOOP format as such:
Code:
Range("N2:AE2").Select
Selection.AutoFill Destination:=Range("N2:AE10"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N10:AE10").Select
Selection.AutoFill Destination:=Range("N10:AE20"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N20:AE20").Select
Selection.AutoFill Destination:=Range("N20:AE30"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N30:AE30").Select
Selection.AutoFill Destination:=Range("N30:AE40"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N40:AE40").Select
Selection.AutoFill Destination:=Range("N40:AE50"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N50:AE50").Select
Selection.AutoFill Destination:=Range("N50:AE60"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N60:AE60").Select
Selection.AutoFill Destination:=Range("N60:AE70"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N70:AE70").Select
Selection.AutoFill Destination:=Range("N70:AE80"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N80:AE80").Select
Selection.AutoFill Destination:=Range("N80:AE90"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N90:AE90").Select
Selection.AutoFill Destination:=Range("N90:AE100"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N100:AE100").Select
Selection.AutoFill Destination:=Range("N100:AE110"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N110:AE110").Select
Selection.AutoFill Destination:=Range("N110:AE120"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N120:AE120").Select
Selection.AutoFill Destination:=Range("N120:AE130"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N130:AE130").Select
Selection.AutoFill Destination:=Range("N130:AE140"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N140:AE140").Select
Selection.AutoFill Destination:=Range("N140:AE150"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N150:AE150").Select
Selection.AutoFill Destination:=Range("N150:AE160"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N160:AE160").Select
Selection.AutoFill Destination:=Range("N160:AE170"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N170:AE170").Select
Selection.AutoFill Destination:=Range("N170:AE180"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N180:AE180").Select
Selection.AutoFill Destination:=Range("N180:AE190"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Range("N190:AE190").Select
Selection.AutoFill Destination:=Range("N190:AE200"), Type:=xlFillDefault
Calculate
Application.Wait (Now + #12:00:12 AM#)
If Not Application.CalculationState = xlDone Then
DoEvents
End If
End Sub
QUESTION: How can I make this autofill every 10 rows per 12 seconds a LOOP with the ability to easily change (for optimizing the scrape [im using the smf excel add in by the way with its 'rchgettablecells' formula contained in each cell of the range]) those per row and per second parameters?
Thank you!
Tom