Thread: Overflow Error
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norie Norie is offline
external usenet poster
 
Posts: 82
Default Overflow Error

Could it be because varCount is 0?

And could that have something to do with ScoreBox(i) ?

Is that an array or are you trying to refer to controls on a userform
or worksheet?

On Jun 25, 7:34*pm, Bishop wrote:
I have the following code:

* * Dim varSum As Integer, varCount As Integer
* * Dim ScoringAve As Double
* * Dim i As Integer
* * For i = 1 To 18
* * * * If Me.Controls(ScoreBox(i)).Text < "" Then
* * * * * * varSum = varSum + Me.Controls(ScoreBox(i)).Text
* * * * * * varCount = varCount + 1
* * * * End If
* * Next
* * ScoringAve = (varSum / varCount)

Why am I getting an Overflow error for ScoringAve?