我的代码抛出以下错误:
运行时错误-2147417748(80010108) 对象工作表的方法单元格失败
在外循环的第8次迭代中遍历counter2循环7次后,它抛出错误。这很奇怪,因为同一个数据上的相同循环在这段代码之前的同一个宏中正常运行:
Do While Worksheets("Sheet1").Cells(counter2, 1).Value <> ""
If (Worksheets("Sheet1").Cells(counter2, categoryPoint).Value = _
Worksheets("Sheet5").Cells(counter, 4).Value) _
And (Worksheets("Sheet1").Cells(counter2, subCategoryPoint).Value = _
Worksheets("Sheet5").Cells(counter, 5).Value) Then
Do While counter3 <> attrCount + 1
If Worksheets("Sheet1").Cells(counter2, counter3).Value = "" Then gold = gold + 1
counter3 = counter3 + 1
Loop
counter2 = counter2 + 1
counter3 = 1
End If
Loop
答案 0 :(得分:0)
没关系,这是一个愚蠢的错误,循环是无限的。不知道为什么它会抛出一个奇怪的错误。不管怎样,谢谢!