Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Line continuation.

Hi,XL2003
I have the following all on one line:

Range("A2") =
"=SUMPRODUCT(--(B$2:B$445=B2)*(C$2:C$445=C2)*(D$2:D$445=D2)*(G$2: G$445=G2)*(H$2:H$445=H2)*(I$2:I$445=I2))"

This line works fine as it is. But if I try to use the <space underscore
line continuation thingy somewhere in the line, the text turns red, and an
error message comes up: Compile error. Expected end of statement.
Is this normal VBA behaviour, or am I missing something?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Line continuation.


You can do something like

S = "=SUMPRODUCT(--(B$2:B$445=B2)*(C$2:C$445=C2)*(D$2:D$445=D2)" & _
"*(G$2:G$445=G2)*(H$2:H$445=H2)*(I$2:I$445=I2) )"

Since you are concatenating strings, each string must be enclosed in "
characters. I suspect you didn't have a " before the line continuation
characters.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sun, 8 Feb 2009 21:29:00 -0800, Dave
wrote:

Hi,XL2003
I have the following all on one line:

Range("A2") =
"=SUMPRODUCT(--(B$2:B$445=B2)*(C$2:C$445=C2)*(D$2:D$445=D2)*(G$2: G$445=G2)*(H$2:H$445=H2)*(I$2:I$445=I2))"

This line works fine as it is. But if I try to use the <space underscore
line continuation thingy somewhere in the line, the text turns red, and an
error message comes up: Compile error. Expected end of statement.
Is this normal VBA behaviour, or am I missing something?

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
Line Continuation issue Bishop Excel Worksheet Functions 6 May 21st 09 01:47 PM
Line Continuation in combination chart CB Charts and Charting in Excel 2 June 24th 08 07:34 PM
Macro Continuation Beep Beep Excel Programming 10 August 15th 07 06:57 PM
continuation from yesterday Mindy Excel Discussion (Misc queries) 4 June 22nd 06 11:13 PM
Line continuation error Todd Huttenstine Excel Programming 4 July 29th 04 05:16 AM


All times are GMT +1. The time now is 01:56 AM.

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"