Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA errors on megaformula 1

Status
Not open for further replies.

Evil8

MIS
Mar 3, 2006
313
US
I am trying to extract middle names in a vba macro in excel 2003, but the I keep getting an error.

Code:
ActiveCell.FormulaR1C1 = _
        "=IF(ISERR(MID(RC[+4],FIND(" [COLOR=red]",RC[+4])+1,IF(ISERR(FIND("[/color] ",RC[+4],FIND(" ",RC[+4])+1)),FIND(" ",RC[+4]),FIND(" ",RC[+4],FIND(" ",RC[+4])+1))-FIND(" ",RC[+4])-1)),"",MID(RC[+4],FIND(" ",RC[+4])+1,IF(ISERR(FIND(" ",RC[+4],FIND(" ",RC[+4])+1)),FIND(" ",RC[+4]),FIND(" ",RC[+4],FIND(" ",RC[+4])+1))-FIND(" ",RC[+4])-1))"

When working in the VBA Editor I get a Compile error: Expected: end of statement and the section that is red is highlighted in grey. I get a can't record error when I try to use the macro recorder as well.

Any help is appreciated.
Evil8
 
ActiveCell.FormulaR1C1 = _
"=IF(ISERR(MID(RC[+4],FIND("" "",RC[+4])+1,IF(ISERR(FIND("" "",RC[+4],FIND("" "",RC[+4])+1)),FIND("" "",RC[+4]),FIND("" "",RC[+4],FIND("" "",RC[+4])+1))-FIND("" "",RC[+4])-1)),"""",MID(RC[+4],FIND("" "",RC[+4])+1,IF(ISERR(FIND("" "",RC[+4],FIND("" "",RC[+4])+1)),FIND("" "",RC[+4]),FIND("" "",RC[+4],FIND("" "",RC[+4])+1))-FIND("" "",RC[+4])-1))"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes! I got to get more sleep, I feel pretty stupid this morning for not remember that I need extra quotation marks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top