ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax to insert an array formula in a cell (https://www.excelbanter.com/excel-programming/351902-syntax-insert-array-formula-cell.html)

mikeburg[_69_]

Syntax to insert an array formula in a cell
 

What would be the proper syntax to have VBA to insert an array formul
in a cell? For example:

SheetData.Range("F4") = "=SUM(F7:F70)" inserts the formula.

However, the following does not work,
SheetData.Range("E4") = "{=SUM(--SUBSTITUTE(0 & E7:E70, " - ",""))}"

Any ideas. Thanks for all your help. mikebur

--
mikebur
-----------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458
View this thread: http://www.excelforum.com/showthread.php?threadid=50667


Karthik Bhat - Bangalore

Syntax to insert an array formula in a cell
 
Hi Mike

You need to use the FormulaArray function

This code should work :

Range("E4").FormulaArray = "=SUM(--SUBSTITUTE(0 & R[3]C:R[66]C, "" -
"",""""))"

Thanks
Karthik Bhat


Tim Williams

Syntax to insert an array formula in a cell
 
From Help:

Worksheets("Sheet1").Range("E1:E3").FormulaArray = _
"=Sum(R1C1:R3C3)"

Tim

"mikeburg" wrote in
message ...

What would be the proper syntax to have VBA to insert an array formula
in a cell? For example:

SheetData.Range("F4") = "=SUM(F7:F70)" inserts the formula.

However, the following does not work,
SheetData.Range("E4") = "{=SUM(--SUBSTITUTE(0 & E7:E70, " - ",""))}"

Any ideas. Thanks for all your help. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=506670




mikeburg[_88_]

Syntax to insert an array formula in a cell
 

Thanks so very much. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=506670


Don Guillett

Syntax to insert an array formula in a cell
 
range("a1").formulaarray=

--
Don Guillett
SalesAid Software

"mikeburg" wrote in
message ...

Thanks so very much. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=506670





All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com