在我的Excel表格中,我有一行(第五行)为物品数量,另一行(第六行)为物品价格。例如,我想将200乘以56.50美元,但是我在这个脚本上遇到了问题。请问有谁能帮忙吗?
这里显示“运行时错误13”
类型不匹配 这是图片:
这是链接:https://www.dropbox.com/s/lla2cuz8hqu5qyp/test.xlsm
而且我不能使用=a*b,我必须使用宏!
Sub calcprice()
Dim i As Integer
Dim iRowNumber As Integer ' Integer to store result in
Dim val As Double
iRowNumber = InputBox(Prompt:="Number of Rows", _
Title:="Rows: ", Default:="# of Rows")
For i = 1 To iRowNumber
If Cells(i, 5).Value >= 0 And Cells(i, 6).Value >= 0 And IsEmpty(Cells(i, 5)) = False And IsEmpty(Cells(i, 5)) = False Then
val = FormatCurrency(Cells(i, 5).Value) * Cells(i, 6).Value
Cells(i, 7).Value = val
End If
Next i
End Sub
这里显示“运行时错误13”
类型不匹配 这是图片:
![it says currency](https://istack.dev59.com/QMOIW.webp)
而且我不能使用=a*b,我必须使用宏!