Stuck on inserting long formula using VB

asad

Well-known Member
Joined
Sep 9, 2008
Messages
1,434
Hi Guys,

I am trying to insert this formula:
Code:
{=IFERROR(PROPER(IF(B5="","",IF(AND(C$1=E$1,MID(B5,2,1)*1=1),INDEX(INDIRECT(F$1&"B13:B193"),MATCH(B5,INDIRECT(F$1&"AT13:AT193"),0)),INDEX(Express_Names,MATCH(B5,INDIRECT("Express!"&HLOOKUP(A$1-C5,Express!$D$10:$J$11,2,0)&"13:"&HLOOKUP(A$1-C5,Express!$D$10:$J$11,2,0)&"193"),0))))),"")}

using this code:
Code:
Dim fp As Range, rng As Range, c As Range
Set fp = Range("F1")           
Set fpl = Range("H1")
           Set rng = Range("D5", "D14")
For Each c In rng
   c.FormulaArray = "=iferror(proper(if(" & c.Offset(, 2).Address & "="""","""",If(and(" & Range("c1") & "=" & Range("E1") & ",MID(" _
   & c.Offset(, 2).Address & ",2,1)*1=1),Index(" & fp & "B13:B193,Match(" & c.Offset(, 2).Address & "," & fp & "AT13:At193,0)),Index(" & Express_Names & ",Match(" _
   & c.Offset(, 2).Address & "," & fpl & ",0))))),"""")"
   Next c
It is giving me an error.

What is it that I am doing wrong? Can you please help me out?

Asad
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Thanks a lot Stephen. I took your advice and did exactly what you said and it WORKED.
I just did the check in VB and if true then do the required else nothing.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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