Error with Insert Formula VBA

thefunstarts

New Member
Joined
Apr 19, 2015
Messages
47
I'm having an issue with a piece of VBA used to insert an Index Match formula. Below is the code I'm using but it's returning an error - I can't figure out why! Can anyone help?!

Code:
Range("E8").Formula = "=IFERROR(INDEX('Data'!$C$2:$XFD$10000, MATCH(1,('Data'!$C$2:$C$10000=Dashboard!$B8)*('Data'!$I$2:$I$10000=Dashboard!$E$6),0),12),"")"
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You need to double up any quotes that appear in the formula:

Code:
Range("E8").Formula = "=IFERROR(INDEX('Data'!$C$2:$XFD$10000, MATCH(1,('Data'!$C$2:$C$10000=Dashboard!$B8)*('Data'!$I$2:$I$10000=Dashboard!$E$6),0),12),[COLOR=#ff0000]"[/COLOR]""[COLOR=#ff0000]"[/COLOR])"
 
Upvote 0
I'm having an issue with a piece of VBA used to insert an Index Match formula. Below is the code I'm using but it's returning an error - I can't figure out why! Can anyone help?!

Code:
Range("E8").Formula = "=IFERROR(INDEX('Data'!$C$2:$XFD$10000, MATCH(1,('Data'!$C$2:$C$10000=Dashboard!$B8)*('Data'!$I$2:$I$10000=Dashboard!$E$6),0),12),"")"

I just realized I had to double quotes for the end of the formula. But I noticed once it inputs the formula you still have to go in a refresh it by clicking "Shift + Ctrl + Enter", is there anyway to automatically update the formulas once inserted in VBA?
 
Upvote 0
If you're entering it as an array formula change:
Code:
Range("E8").Formula
to
Code:
Range("E8").FormulaArray
 
Upvote 0

Forum statistics

Threads
1,214,381
Messages
6,119,192
Members
448,874
Latest member
Lancelots

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