运行时错误'6':溢出 - 循环查询 [英] Run-time error '6': Overflow - Looping inquiry
问题描述
使用MS Visual Basic 6.5。 MS Excel 2007 v12。
我可能会在这个星期一早上遇到精神障碍,但我似乎无法修复我使用以下循环获得的溢出:
对于y = 1到100¥ b $ b
x = Sheet1.Cells(y,1).value
对于j = 1到100
如果x = Sheet2.Cells(j,1).value那么
  ;   adj = 0
i = 4
Do While(i< 100)
&NBSP;&NBSP;
adj = adj +(Sheet3.Cells(y,(i + 1))。value - Sheet3.Cells(y,i).value)
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; i = i + 1
循环
  ;&NBSP;&NBSP;&NBSP;&NBSP;
Sheet1.Cells(y,2).value = Sheet2.Cells(j,2).value + adj
&NBSP;&NBSP;&NBSP;否则为
结束如果
下一个j
$
下一个
Do While循环的第一行出现错误:
adj = adj +(Sheet3.Cells(y,(i + 1))。value - Sheet3.Cells(y,i).value)
任何帮助都是非常感谢!
干杯!
一切都好!
我忘了放置一个条件语句来验证 Sheet3.Cells(y ,i)...
包含值。
Using MS Visual Basic 6.5. MS Excel 2007 v12.
I might be hitting a mental block on this Monday morning, but I can't seem to fix the overflow I get using the following loop:
For y = 1 To 100
x = Sheet1.Cells(y, 1).value
For j = 1 To 100
If x = Sheet2.Cells(j, 1).value Then
adj = 0
i = 4
Do While (i < 100)
adj = adj + (Sheet3.Cells(y, (i + 1)).value - Sheet3.Cells(y, i).value)
i = i + 1
Loop
Sheet1.Cells(y, 2).value = Sheet2.Cells(j, 2).value + adj
Else
End If
Next j
Next y
The error occurs on the first line of the Do While loop:
adj = adj + (Sheet3.Cells(y, (i + 1)).value - Sheet3.Cells(y, i).value)
Any help would be greatly appreciated!
Cheers!
All good!
I forgot to place a conditional statement that would verify that the Sheet3.Cells(y, i) ... have values in them.
这篇关于运行时错误'6':溢出 - 循环查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!