Reputation: 1692
So I have something like this:
A B C
1 11 12 13
2 10 20 15
3 1 -8 -2
So A3
, B3
, and C3
is generated by subtracting A1
to A2
and so on.
If you look at the top of the sheet there is a long bar that shows the formula of a cell when you click on one. If you fill in the sheet manually, you can type in that bar something like = A1 - A2
and it will fill A3
for you.
Right now, because my formula is actually in the code, when I click on A3
for example, the bar only shows 1
instead of = A1 - A2
.
How do I get the formula to be displayed in the bar?
Upvotes: 0
Views: 535
Reputation: 1186
Use .formula for your requirement
Worksheets("Sheet1").Range("A3").Formula = "=A1-A2"
Upvotes: 1
Reputation: 940
My guess is that right now, you're filling your cell along the lines of:
Range("A3").Value = Range("A1").Value - Range("A2").Value
So solve your Problem, use this:
Range("A3").FormulaLocal = "=SUM(A1;A2)"
Upvotes: 1