Setting a Cell's Formula

95 views
Skip to first unread message

Chris Spicer

unread,
Sep 3, 2009, 5:57:06 PM9/3/09
to ExcelDna
Hi,

Is it possible to set the formula of a cell through ExcelDna? By this
I mean through a menu driven macro function, rather than triggerd by a
UDF.

I notice that the C API supports xlset for quickly setting a value to
cell, but this doesn't seem appropriate for formulas.

Regards,

Chris Spicer

Govert van Drimmelen

unread,
Sep 4, 2009, 4:14:49 AM9/4/09
to ExcelDna
Hi Chris,

You can try something like
XlCall.Excel(XlCall.xlcFormula, "=2+2", theReference)

References in the formula have to be R1C1-style.
Use XlCall.xlcFomulaArray for an array formula.

Hope this helps.

Govert

Chris Spicer

unread,
Sep 6, 2009, 11:30:12 AM9/6/09
to ExcelDna
Excellent response as always Govert. Thanks for that.
Reply all
Reply to author
Forward
0 new messages