我正在尝试获取一个脚本来查找相应的列并创建一个公式,其中包含“name”单元格。这是脚本:
<html>
<head>
<meta charset="utf-8">
<base href="/">
</head>
现在返回公式'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)
。我该怎么做?
答案 0 :(得分:3)
您可以使用.Address
属性。
Range("D5").Formula = "=IF(" & Cells(15, i).Address & "<>"""",D4*" & Cells(15, i).Address & ","""")"
例如:
MsgBox(Cells(1,1).Address)
会返回$A$1