好的,基本上我有一个销售管理系统,列出了所有待售的漫画,我正在尝试添加一种方法来添加另一个漫画。一切正常,但我需要更新显示总数的公式,以及我在下面的代码中尝试过的公式,但是当我尝试将我的 cellnum 设置为搜索返回的行号时,它会抛出一个 object required 错误。
Dim cellnum As Integer
Set cellnum = range("B4:B500").Find("TOTALS").Row
Dim cellnum_minus As Integer
Set cellnum_minus = cellnum - 1
Dim cellnum_plus As Integer
Set cellnum_plus = cellnum + 1
range("O" & cellnum).Value = "=SUM(O4:O" & cellnum_minus & ")"
range("Q" & cellnum).Value = "=AVERAGE(O4:O" & cellnum_minus & ")"
range("R" & cellnum).Value = "=MAX(R4:R" & cellnum_minus & ")"
range("S" & cellnum).Value = "=MIN(S4:S" & cellnum_minus & ")"
range("C" & cellnum_plus).Value = "=C" & cellnum & "/10"
range("D" & cellnum_plus).Value = "=D" & cellnum & "/10"
range("E" & cellnum_plus).Value = "=E" & cellnum & "/10"
range("F" & cellnum_plus).Value = "=F" & cellnum & "/10"
range("G" & cellnum_plus).Value = "=G" & cellnum & "/10"
range("H" & cellnum_plus).Value = "=H" & cellnum & "/10"
range("I" & cellnum_plus).Value = "=I" & cellnum & "/10"
range("J" & cellnum_plus).Value = "=J" & cellnum & "/10"
range("K" & cellnum_plus).Value = "=K" & cellnum & "/10"
range("L" & cellnum_plus).Value = "=L" & cellnum & "/10"
range("M" & cellnum_plus).Value = "=M" & cellnum & "/10"
range("N" & cellnum_plus).Value = "=N" & cellnum & "/10"