Formula Array Property

The FormulaArray property returns or sets an array formula, which must be in R1C1 style, for a range. To illustrate, consider the worksheet shown in Figure 19-14. The code:

Range("A9:C11").FormulaArray = "=A1:C3 + A5:C7"

produced the values in cells A9:C11 in Figure 19-14. The formula on the left says to add the contents of each cell in the uppermost 3-by-3 array to the corresponding cell in the middle 3-by-3 array, and place the result in the corresponding cell in the lower 3-by-3 array.

Figure 19-14. Illustrating the FormulaArray property

A

B

C

1

1

2

3

2

5

6

3

7

0

9

4

5

10

11

12

6

13

14

15

7 |

| 16

17

18

e

9

11

13

15

10

17

19

21

11

23

25

27

Note also that the code:

Debug.Print Range("A9").FormulaArray prints the array formula:

0 0

Post a comment