如何在excel 2003中将vba代码分成两行或多行 [英] how to break vba code into two or more lines in excel 2003
本文介绍了如何在excel 2003中将vba代码分成两行或多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在excel 2007上有一个VBA代码,公式记录一个,它的长度只有一点点大,现在我想跑这个宏为2003 excel,但它正在抛出一些错误信息。我需要将记录的excel公式分成两行或更多行。你能不能请任何人帮助我。
例如,
范围(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,查找(索赔,RC [-4]) - 6)))
我需要打破上面的公式。
提前致谢,
Gok
解决方案
在你要破线的地方加一个下划线:
范围( 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 ( 权利要求 ,RC [-4]) - 6)))跨度>
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
解决方案
Put an underline at the point whereyou want to break the line:
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)))"
这篇关于如何在excel 2003中将vba代码分成两行或多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文