我正在尝试获取一个脚本来查找适当的列,并创建一个包含该单元格“名称”的公式。这是脚本:
'Search for value
Dim i As Integer
i = 4
Do Until Cells(9, i).Value = ddLeveranciers.Value Or Cells(9, i).Value = ""
i = i + 1
Loop
'Add formulas
Range("D5").Formula = "=IF(" & Cells(15, i) & "<>"""",D4*" & Cells(15, i) & ","""")"
现在将返回公式"=IF(1.23<>"",D4*1.23,"")"
,1.23
即的值cells(15,i)
。我希望脚本返回(例如)"=IF(D15<>"",D4*D15,"")"
。我怎么做?
您可以使用该.Address
属性。
Range("D5").Formula = "=IF(" & Cells(15, i).Address & "<>"""",D4*" & Cells(15, i).Address & ","""")"
例如:
MsgBox(Cells(1,1).Address)
会回来 $A$1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句