Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下代码来计算一系列单元格中的最大值:
Range("E3").Select ActiveCell.FormulaR1C1 = "=MAX(RC[-3]:R[50]C[-3])"
如何在我的代码中用变量替换 50?
谢谢你的帮助!
你有没有试过这个:
Dim sVal as String sVal = "50" ActiveCell.FormulaR1C1 = "=MAX(RC[-3]:R[" & sVal & " ]C[-3])"
像这样的东西:
Dim somevar as Integer somevar = 50 ActiveCell.FormulaR1C1 = "=MAX(RC[-3]:R[" + somevar + "]C[-3])"