Reputation: 11
I have built the macro as following and it is working well. However, I have a problem with this. I want to see how the calculations in each cell was performed such as in "$B$6+A6" format in the original excel file but I am unable to do so. It would be really nice if you can help me out with this.
Thank you very much
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
Upvotes: 1
Views: 56
Reputation: 747
As far as I can see your formula is equal to value, therefore you receive a number as a result. Please try to modify your code like this:
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
Part Cells(d, b).Formula = "=" & Cells(d, e).Address & "*2"
will put in Cells(d,b)
a formula e.g. "=$A$1*2"
Upvotes: 2