Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi All,

I have a VBA code in excel 2007 and the the formula is recorded one and its length is little big only, now I want to run this macro for 2003 excel, but it is throwing some erroor message. I need to break the recorded excel formula into two or more lines. can you please any one help me.

for example,
Range("E2 : E" & LRow).FormulaR1C1 = "=TRIM(IF(ISERROR(FIND(""Claim Remark Codes:"",RC[-4])),
IF(ISERROR(FIND(""ICN:"",RC[-4])),R[-1]C,IF(ISERROR(FIND(""."",RC[-4])),
RIGHT(RC[-4],LEN(RC[-4])-FIND(""ICN:"",RC[-4])-3),MID(RC[-4],5,FIND(""|"",
SUBSTITUTE(RC[-4],"" "",""|"",LEN(RC[-4])-LEN(SUBSTITUTE(RC[-4],"" "",""""))))-1-
FIND("":"",RC[-4])))),MID(RC[-4],FIND(""ICN:"",RC[-4])+4,FIND(""Claim"",RC[-4])-6)))"
I need to break the formula like above.

Thanks in advance,
Gok
Posted
Updated 19-May-14 4:12am
v2

1 solution

Put an underline at the point whereyou want to break the line:
VB
Range("E2 : E" & LRow).FormulaR1C1 = "=TRIM(IF(ISERROR(FIND(""Claim Remark Codes:"",RC[-4])), _
IF(ISERROR(FIND(""ICN:"",RC[-4])),R[-1]C,IF(ISERROR(FIND(""."",RC[-4])), _
RIGHT(RC[-4],LEN(RC[-4])-FIND(""ICN:"",RC[-4])-3),MID(RC[-4],5,FIND(""|"", _
SUBSTITUTE(RC[-4],"" "",""|"",LEN(RC[-4]) _
LEN(SUBSTITUTE(RC[-4],"" "",""""))))-1- _
FIND("":"",RC[-4])))),MID(RC[-4],FIND(""ICN:"",RC[-4])+4,FIND(""Claim"",RC[-4])-6)))"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900