|
别人用excle2003帮我编了个程序,但是在excle2010里运行老是下界越标。Sub test()
Dim a As Integer
Dim B As Integer
Dim c As Integer
c = 1
For a = 1 To 5200
If Cells(a, 4) > 0 Then
[e1] = "=MID(D" & a & ",4,1)*1"
If [e1] = 3 Then
B = a
Else
If [e1] = 4 Then
Sheets("结果").Cells(c, 1) = Sheets("数据").Cells(a, 1)
Sheets("结果").Cells(c, 2) = Sheets("数据").Cells(a, 2) - Sheets("数据").Cells(B, 2)
Sheets("结果").Cells(c, 3) = Sheets("数据").Cells(a, 3) - Sheets("数据").Cells(B, 3)
Sheets("结果").Cells(c, 4) = Sheets("数据").Cells(a, 4)
c = c + 1
Else
End If
End If
End If
Next a
End Sub
问题出在哪个地方啊?谢谢了哦!
你的工作表里,没有 结果,数据 这两个工作表,肯定下标越界嘛。
|
|