T
TKS_Mark
I'm pulling in a formula to a cell based on the contents of another sheet.
Since Excel converts that formula to text, I'm writing a macro to copy from
one cell and paste values to another.
Example: One cell has =VLOOKUP(D,AZInputs,9). This give me a formula like
=(C:C)*(F:F) because that is the contents of column 9 on the named range
AZInputs.
My macro will copy this looked up formula from one cell to another and paste
values so that instead of seeing the lookup =VLOOKUP(D,AZInputs,9) in the
cell contents, I see the pasted formula, =(C:C)*(F:F).
So far, so good. I don't have a problem up to here. But the pasted formula
is text instead of a true formula so even on the spread sheet I see
=(C:C)*(F:F) instead of the results of that formula (2x4=8). If I select
this cell, click the F2 button (edit), and then just hit enter, the cell
realizes it's a formula and gives me the results.
Finally my question: How can write a macro that would be the equivelant of
clicking F2 and hitting enter. When I click record macro, I get the results
below, which aren't generic enough.
Sub junk()
ActiveCell.FormulaR1C1 = "=(C:C)*(F:F)"
Range("F4").Select
End Sub
Since Excel converts that formula to text, I'm writing a macro to copy from
one cell and paste values to another.
Example: One cell has =VLOOKUP(D,AZInputs,9). This give me a formula like
=(C:C)*(F:F) because that is the contents of column 9 on the named range
AZInputs.
My macro will copy this looked up formula from one cell to another and paste
values so that instead of seeing the lookup =VLOOKUP(D,AZInputs,9) in the
cell contents, I see the pasted formula, =(C:C)*(F:F).
So far, so good. I don't have a problem up to here. But the pasted formula
is text instead of a true formula so even on the spread sheet I see
=(C:C)*(F:F) instead of the results of that formula (2x4=8). If I select
this cell, click the F2 button (edit), and then just hit enter, the cell
realizes it's a formula and gives me the results.
Finally my question: How can write a macro that would be the equivelant of
clicking F2 and hitting enter. When I click record macro, I get the results
below, which aren't generic enough.
Sub junk()
ActiveCell.FormulaR1C1 = "=(C:C)*(F:F)"
Range("F4").Select
End Sub