LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Single line of code with line separator

Hello All -

I have an IF stmt that's fairly long, and it works.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-15]=""abc"",1.5,
IF(OR(RC[-1]={""xx"",""xx""}),4.0,
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx""}),3.5,
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx"",""xx""}),3, IF(OR(RC[-1]={""A6"",""AB"",""AV"",""ZU"",""xx""}),2.5,
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx"",""xx""}),2, IF(OR(RC[-1]={""A1"",""A2"",""xx""}),1.5,"""")))))))"

However, if I try to break it into segments for useability, I get an
"Expected: end of statement" or "Syntax Error."

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-15]=""abc"",1.5, _
IF(OR(RC[-1]={""xx"",""xx""}),4.0, _
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx""}),3.5, _
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx"",""xx""}),3, _
IF(OR(RC[-1]={""A6"",""AB"",""AV"",""ZU"",""xx""}),2.5, _
IF(OR(RC[-1]={""xx"",""xx"",""xx"",""xx"",""xx"",""xx"",""xx"" ,""xx"",""xx""}),2, _
IF(OR(RC[-1]={""A1"",""A2"",""xx""}),1.5,"""")))))))"

The ONLY difference is the multiple lines. What is the magic to breaking up
a line when I want more than 1 row?

KarenF

 
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
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
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
Concatenate: Multi-Line Cell with 2 single line cells BEEJAY Excel Worksheet Functions 0 February 15th 07 08:53 PM
how do you execute single line of code? honestlylion Excel Discussion (Misc queries) 2 February 24th 06 03:35 PM
VBA Array Population with a Single Line of Code James B Excel Programming 7 February 6th 04 09:37 AM


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

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

About Us

"It's about Microsoft Excel"