正如标题所示,我无法弄清楚如何使用行的变量进入单元格。我附上了我目前拥有的代码,评论部分就是我遇到的问题,谢谢!
Private Sub Go_Click()
Dim id As Double
Dim qt As Double
Dim num As Double
Dim rngSearch As Range, rngFound As Range
id = Range("D4").Value
qt = Range("E4").Value
Set rngSearch = Range("A:A")
Set rngFound = rngSearch.Find(What:=id, LookIn:=xlValues, LookAt:=xlPart)
num = rngFound.Row
If rngFound Is Nothing Then
MsgBox "Stock ID Not Found"
Else
MsgBox rngFound.Row
'Range("O num.Value") = Range("O num.Value") - qt
End If
Range(rngFound.Row) = Range(rngFound.Row) - qt
End Sub
答案 0 :(得分:1)
也许
Range("O" & num).value=Range("O" & num).value-qt