ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   do if loop (https://www.excelbanter.com/excel-programming/344162-re-do-if-loop.html)

Jim Thomlinson[_4_]

do if loop
 
turn of the automaitic calculations

application.calclation = xlmanual
'Your code

application.calculation = xlAutomatic
end sub

--
HTH...

Jim Thomlinson


"bozo the clown" wrote:

I am trying to write a loop. If a condition is met then run the code and
return back to the "do if" statement. I have one that works but it maxs out
the cpu and is slow(see below). Is there anything better?

Sub Time_set()
If Range("A65536") < Range("A65536").Offset(0, 2) Then
Range("A39999:AD39999").Select
Selection.Delete Shift:=xlUp
Range("C65536").Select
ActiveCell.FormulaR1C1 = "=CURRENCIES!R[-65535]C"
Range("D65536").Select
ActiveCell.FormulaR1C1 = "=CURRENCIES!R[-65535]C[-2]"
ActiveCell.Offset(0, -1).Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(0, -2).Range("A1").Select
ActiveCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Range("E65535:AD65535").Select
Selection.AutoFill Destination:=Range("E65535:AD65536"), Type:= _
xlFillDefault
Range("E65535:AD65536").Select
Else

End If
Application.OnTime Now + TimeValue("00:00:01"), "time_set"

End Sub



All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com