VBA Array Formula

G

Guest

Guest
Hi,
How do you write Array Formulas using VBA? Range(cell).FormulaR1C1 = xxx doesn't seem to work
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
On 2002-02-28 23:23, Anonymous wrote:
Hi,
How do you write Array Formulas using VBA? Range(cell).FormulaR1C1 = xxx doesn't seem to work

Range(cell).FromulaArray = xxx


Ivan
 
Upvote 0
Try this

Range("A1").Select
ActiveCell.Formula = "=SUM(B1:B3)"
As a result
A1 will have the sum of B1,B2 and B3
 
Upvote 0
Code:
sht.Range(Cells(4, 19), Cells(x, 19)).FormulaArray = "=INDEX(Sábana!R2C2:R400C2,MATCH(1,(RC12=Sábana!R2C3:R400C3)+(RC12=Sábana!R2C4:R400C4)+(RC12=Sábana!R2C5:R400C5)+(RC12=Sábana!R2C6:R400C6)+(RC12=Sábana!R2C7:R400C7)+(RC12=Sábana!R2C8:R400C8)+(RC12=Sábana!R2C9:R400C9)+(RC12=Sábana!R2C10:R400C10)+(RC12=Sábana!R2C11:R400C11)+(RC12=Sábana!R2C12:R400C12)+(RC12=Sábana!R2C13:R400C13)+(RC12=Sábana!R2C14:R400C14)+(RC12=Sábana!R2C15:R400C15),0))"

This formula works with ".formular1c1" but no with formularray, runtime error 1004, any ideas why? thx
 
Upvote 0

Forum statistics

Threads
1,213,524
Messages
6,114,117
Members
448,549
Latest member
brianhfield

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top