Excel formula 计算后查看单元地址

Excel formula 计算后查看单元地址,excel-formula,Excel Formula,我已经建立了如下宏,它工作得很好。然而,我有一个问题。我想查看每个单元格中的计算是如何执行的,例如原始excel文件中的“$B$6+A6”格式,但我无法这样做。如果你能帮我解决这个问题,那就太好了 多谢各位 Sub RCinput() Dim a As Long Dim b As Long Dim c As Long Dim d As Long Dim e As Long a = InputBox("What is the row number: ") b = InputBox(

我已经建立了如下宏,它工作得很好。然而,我有一个问题。我想查看每个单元格中的计算是如何执行的,例如原始excel文件中的“$B$6+A6”格式,但我无法这样做。如果你能帮我解决这个问题,那就太好了


多谢各位

Sub RCinput()

Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim e As Long




 a = InputBox("What is the row number: ")

 b = InputBox("What is the column number: ")

 c = InputBox("What is the last row number: ")

 e = b - 1


For d = a To c

Cells(d, b).Formula = Cells(d, e).Value * 2

Next


End Sub

据我所知,您的公式等于value,因此您将得到一个数字。请尝试按以下方式修改您的代码:

Sub RCinput()

Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim e As Long

 a = InputBox("What is the row number: ")

 b = InputBox("What is the column number: ")

 c = InputBox("What is the last row number: ")

 e = b - 1

For d = a To c

Cells(d, b).Formula = "=" & Cells(d, e).Address & "* 2"

Next

End Sub

部分
单元格(d,b)。公式=“=”&单元格(d,e)。地址和“*2”
将放入
单元格(d,b)
一个公式,例如
“=$a$1*2”

将宏打印出公式/中间结果…很抱歉,我无法理解。我不想打印出来,我只想查看每个单元格中的计算是如何执行的,正如我们通常在excel中看到的那样,但使用上述代码,我不理解-请编辑-重新措辞并澄清您想要的内容。非常感谢您的帮助。它工作得很好。如何将其作为相对参考而不是绝对参考。另外,我想做一些特殊的操作,比如sqrt()、exp或log。我正试图像你对上面所做的那样去做,但似乎我无法做到。我想我找到了做相对引用的方法,但我仍然坚持使用上面样式的特殊数学运算。对于相对公式,你应该将
.Address
更改为
。Address(False,False)
。如果你想在公式中有“exp”,你应该在公式中放一个字符串。例如
单元格(d,b).Formula=“=exp”(&Cells(d,e).Address(False,False))和“*2”
非常感谢