Excel VBA Run-time error 1004 when inserting or value formula into cell

Inserting a formula with VBA requires that you use EN-US standards like,

Range("B64").Formula = "=INDEX(AK7:AK123, G74, 1)"

… or use the regional formula attribute like,

Range("B64").FormulaLocal = "=INDEX(AK7:AK123; G74; 1)"

You may have to also change INDEX to the regional equivalent. The latter is necessary when you have a system with regional settings that do not use the EN-US standard of a comma for a list separator.

see Range.FormulaLocal Property (Excel) for more information.

Leave a Comment