|
Sub 非标件计算()
For r = 9 To Cells(Rows.Count, 4).End(3).Row
mark = Split("x,X,*", ",") '分割标志任意添加
arr = Right(Cells(r, 5), Len(Cells(r, 5)) - 1)
For i = 0 To UBound(mark)
arr = Replace(arr, mark(i), Space(1))
Next i
arr = Split(arr)
If Cells(r, 18) = "非标" And Cells(r, 4) = "矩形管" Then
Cells(r, 6) = (Val(arr(0)) + Val(arr(1))) * 2 * Val(arr(2)) * 0.00785
Cells(r, 16) = (Val(arr(0)) + Val(arr(1))) * 2 / 1000
Else
If Cells(r, 18) = "非标" And Cells(r, 4) = "Z型钢" Then
Cells(r, 6) = Val(arr(0))
Cells(r, 16) = (Val(arr(0)) + Val(arr(1)))
End If
End If
Next r
End Sub
这个一运行就会报错5‘,但是如果我把它改成arr = Cells(r, 5)就没有这个问题,请问以下是什么原因我应该如何修改
|
|