Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hoping someone can help me with this problem...
Just for a bit of fun I am running the following code: Sub TimeTest() '100 million random numbers, tests, and math operations Dim x As Long Dim StartTime As Single Dim i As Long x = 0 StartTime = Timer For i = 1 To 100000000 If Rnd <= 0.5 Then x = x + 1 Else x = x - 1 Next i MsgBox Timer - StartTime & " seconds" End Sub Now, every now and again this throws an error with the following message: Runtime error '16': Expression too complex The debugger indicates the problem lies with this line: If Rnd <= 0.5 Then x = x + 1 Else x = x - 1 Can anyone suggest why this very simple expression be considered by VBA to be too complex only some of the time?? Thanks Dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error '1004' application or object defined error | Excel Programming | |||
runtime error 13 - type mismatch error in Excel 97 on Citrix | Excel Programming | |||
runtime error '1004' application or object defined error. Please help | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |