chollida
chollida

Reputation: 7894

A programatically assigned formula is not updating

I'm assigning a formula to a column via a VBA subroutine.

The sub looks something like:

While curCell.Formula <> ""
    curCell.Formula = "=MATCH(RC[-20],"E:E",0)"
Wend

After running the subroutine the formula is correctly copied but all the cells show "#NAME?". If I select a cell and hit enter then the formula is correctly calculated and the result is shown.

Automatic calculations are turned on.

Upvotes: 0

Views: 164

Answers (1)

Charles Williams
Charles Williams

Reputation: 23505

Its not a good idea to try to mix R1C1 and A1 notation in the same formula. Try something like

Range("z1").FormulaR1C1 = "=MATCH(RC[-20],C5:C5,0)"

Upvotes: 3

Related Questions