Thread
:
Overflow error in Progress Bar
View Single Post
#
2
Posted to microsoft.public.excel.programming
Nigel[_2_]
external usenet poster
Posts: 735
Overflow error in Progress Bar
Try using
Dim i As Long
The overflow occurs when computing the new cell value beyond the limit of
the integer range for i.
--
Regards,
Nigel
"René" wrote in message
...
I got an "Overflow" error in one of my Progress Bar. When debugging the
code, I found out that I am able to reproduce the problem any time. The
bar
width is 300 points and I want to show progress 200 times. The sample
code
below reproduce the problem all the time. Can someone tell me what is
wrong?
By the way, I am using Ms-Office Excel 2003 SP3.
Sub CheckOverflow()
Dim i As Integer
Dim r As Integer
r = 200
On Error Resume Next
For i = 1 To r
Err.Clear
Cells(i, 1) = 300 * (i - 1) / r
If Err Then Cells(i, 1) = Error(Err)
'Call MyMacro()
Next i
End Sub
Reply With Quote
Nigel[_2_]
View Public Profile
Find all posts by Nigel[_2_]