【发布时间】:2015-11-13 14:58:13
【问题描述】:
我正在尝试创建一个基本的 VBA 脚本来检查一列单元格,并在找到特定值时将某些内容添加到不同列的同一行。
我在这上面花了几个小时,最初它运行但没有结果。现在我重构了代码,无论我做什么,我都会得到一个编译错误:
参数数量错误或属性分配无效。
这是我的代码 -
Sub Price_Check()
Dim i As Integer, SearchList As Range, Price As Currency
SearchList = Range("R1:R5000")
Price = 3.99
i = 0
For Each cell In SearchList
i = i + 1
If cell.Value = Price Then
Cells.Value(2, i) = 2000
End If
Next cell
End Sub
【问题讨论】:
标签: vba loops if-statement cell