Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Multiple line

I have a vlookup in my code. Because the code is long I break it into two
lines but I am getting a message that says there is a syntax error. The code
is as follows. Anyone can help me? Thanks.

Selection.FormulaR1C1 =
"=IF((ISERROR(VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0))), _
"""",VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0))"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Multiple line

You cannot use the line continuation half way through a string. But you can
stop the string and concatenate another :
Dim FormulaStr as string
FormulaStr="=IF((ISERROR(VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0)))," & _
""""",VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0))"
Selection.FormulaR1C1 = FormulaStr

And note the extra " at the end of the first and begining of the first
parts.

NickHK

"linglc" wrote in message
...
I have a vlookup in my code. Because the code is long I break it into two
lines but I am getting a message that says there is a syntax error. The

code
is as follows. Anyone can help me? Thanks.

Selection.FormulaR1C1 =
"=IF((ISERROR(VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0))), _
"""",VLOOKUP(C[-4],Table!C[-6]:C[-5],2,0))"



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How show single line rather than multiple line with same desc in e nick New Users to Excel 1 July 1st 09 08:16 AM
Multiple Line Graphs insitu Charts and Charting in Excel 5 September 9th 08 11:11 PM
display 1 line of multiple worksheets into multiple lines on 1 wks Golf Nut Excel Worksheet Functions 1 October 5th 06 08:28 AM
read multiple line JaiJai[_5_] Excel Programming 10 November 14th 05 02:01 PM
multiple line two accumulators EED Excel Programming 14 June 27th 05 03:28 PM


All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"