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

Hey guys


I am getting the error "Too many line continuations" when
I try to add another line. I have 24 line continuations
and when I try to add a 25th, I get the error. Does
anyone know a work around because it just so happens I was
able to get it to only 24 lines but in the future, I may
need 25 or more.


Thank you
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Line continuation error

Hi Todd,

Todd Huttenstine wrote:
I am getting the error "Too many line continuations" when
I try to add another line. I have 24 line continuations
and when I try to add a 25th, I get the error. Does
anyone know a work around because it just so happens I was
able to get it to only 24 lines but in the future, I may
need 25 or more.


IIRC, the limit on line continuations is 25, as you have found. Typically,
you can work around this fairly easily. For example, if you have a long SQL
statement like this:

sSQL = "SELECT ee.FirstName, ee.LastName " & _
"FROM dbo.tblEmployees ee WITH (NOLOCK) " & _
"WHERE ee.EEID IN (1, 2, 3, 4) " & _
"ORDER BY ee.LastName, ee.FirstName"

You could rewrite it as follows:

sSQL = "SELECT ee.FirstName, ee.LastName "
sSQL = sSQL & "FROM dbo.tblEmployees ee WITH (NOLOCK) "
sSQL = sSQL & "WHERE ee.EEID IN (1, 2, 3, 4) "
sSQL = sSQL & "ORDER BY ee.LastName, ee.FirstName"

Thus avoiding the line continuations. If you have a long IF statment with
many Ands and Ors, you can break those up into separate Booleans and And/Or
the resulting variables.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #3   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Line continuation error

You can generally avoid this problem by breaking your work
down into smaller chunks and then referring to the chunks.
A better answer would depend on what situation you are
using line continuation in (comments, code, etc.).

Where text is the too long, instead of:

YourAnswer = InputBox("Please provide lots and lots of
information that includes blah blah blah and on and on and
on until I've used every word in the dictionary and then
repeated those words until my throat is sore just thinking
about it and then and then and then.......... until I'm
done")

You might try:

Prompt1 = Please provide lots and lots......
Prompt2 = until I've used every word...........
Prompt3 = until I'm done.

YourAnswer = InputBox(Prompt1 & " " & Prompt2 & " " &
Prompt3)

tod

-----Original Message-----
Hey guys


I am getting the error "Too many line continuations" when
I try to add another line. I have 24 line continuations
and when I try to add a 25th, I get the error. Does
anyone know a work around because it just so happens I

was
able to get it to only 24 lines but in the future, I may
need 25 or more.


Thank you
Todd Huttenstine
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Line continuation error

'Code below creates a procedure in module Sheet1
Dim VBCodeMod As CodeModule
Dim LineNum As Long

Set VBCodeMod = Workbooks
("RDFMTD.xls").VBProject.VBComponents("Sheet1").Co deModule
With VBCodeMod
LineNum = .CountOfLines + 1
.InsertLines LineNum, _
"Private Sub Worksheet_Change(ByVal Target As
Excel.Range)" & Chr(13) & _
"Dim Counter As Long" & Chr(13) & _
"Dim TargetAddress" & Chr(13) & _
"On Error Resume Next" & Chr(13) & _
"Counter = Application.WorksheetFunction.CountA(Worksheets
(1).Range(" & Chr(34) & "K:K" & Chr(34) & "))" & Chr(13) &
_
"TargetValue = Target.Value" & Chr(13) & _
"Target = UCase(Target)" & Chr(13) & _
"TargetAddress = Target.Address" & Chr(13) & _
"TACL = Left(Target.Address(, 0), InStr(Target.Address(,
0), " & Chr(34) & "$" & Chr(34) & ") - 1)" & Chr(13) & _
"If TACL = " & Chr(34) & "Z" & Chr(34) & " Then" & Chr(13)
& _
"Target.Offset(1, -15).Select" & Chr(13) & _
"Else" & Chr(13) & _
"Set myRange = Intersect(Range(" & Chr(34) & "K2:K" & Chr
(34) & "& Counter), Target)" & Chr(13) & _
"If TargetValue = " & Chr(34) & "y" & Chr(34) & " Or
TargetValue = " & Chr(34) & "Y" & Chr(34) & " Then" & Chr
(13) & _
"Target.Offset(1, 0).Select" & Chr(13) & _
"Exit Sub" & Chr(13) & _
"Else" & Chr(13) & _
"End If" & Chr(13) & _
"If Not myRange Is Nothing Then" & Chr(13) & _
"Target.Offset(0, 15).Select" & Chr(13) & _
"SendKeys " & Chr(34) & "%{down}" & Chr(34) & Chr(13) & _
"End If" & Chr(13) & _
"End If" & Chr(13) & _
"End Sub"
End With
'-------------------------------------

Above is my code. It adds lines of code inside a module.
If I need to add more lines to the module I am adding
lines to by using this code, which in turn will mean I
need to add more lines of code to this code (code above),
would I be able to do this?


-----Original Message-----
Hey guys


I am getting the error "Too many line continuations" when
I try to add another line. I have 24 line continuations
and when I try to add a 25th, I get the error. Does
anyone know a work around because it just so happens I

was
able to get it to only 24 lines but in the future, I may
need 25 or more.


Thank you
Todd Huttenstine
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Line continuation error

Split your long string into two or more substrings; then concatenate the
substrings:

substr1 = ..........
substr2 = ..........

..InsertLines LineNum, substr1 & substr2

--

Vasant



"Todd Huttenstine" wrote in message
...
'Code below creates a procedure in module Sheet1
Dim VBCodeMod As CodeModule
Dim LineNum As Long

Set VBCodeMod = Workbooks
("RDFMTD.xls").VBProject.VBComponents("Sheet1").Co deModule
With VBCodeMod
LineNum = .CountOfLines + 1
.InsertLines LineNum, _
"Private Sub Worksheet_Change(ByVal Target As
Excel.Range)" & Chr(13) & _
"Dim Counter As Long" & Chr(13) & _
"Dim TargetAddress" & Chr(13) & _
"On Error Resume Next" & Chr(13) & _
"Counter = Application.WorksheetFunction.CountA(Worksheets
(1).Range(" & Chr(34) & "K:K" & Chr(34) & "))" & Chr(13) &
_
"TargetValue = Target.Value" & Chr(13) & _
"Target = UCase(Target)" & Chr(13) & _
"TargetAddress = Target.Address" & Chr(13) & _
"TACL = Left(Target.Address(, 0), InStr(Target.Address(,
0), " & Chr(34) & "$" & Chr(34) & ") - 1)" & Chr(13) & _
"If TACL = " & Chr(34) & "Z" & Chr(34) & " Then" & Chr(13)
& _
"Target.Offset(1, -15).Select" & Chr(13) & _
"Else" & Chr(13) & _
"Set myRange = Intersect(Range(" & Chr(34) & "K2:K" & Chr
(34) & "& Counter), Target)" & Chr(13) & _
"If TargetValue = " & Chr(34) & "y" & Chr(34) & " Or
TargetValue = " & Chr(34) & "Y" & Chr(34) & " Then" & Chr
(13) & _
"Target.Offset(1, 0).Select" & Chr(13) & _
"Exit Sub" & Chr(13) & _
"Else" & Chr(13) & _
"End If" & Chr(13) & _
"If Not myRange Is Nothing Then" & Chr(13) & _
"Target.Offset(0, 15).Select" & Chr(13) & _
"SendKeys " & Chr(34) & "%{down}" & Chr(34) & Chr(13) & _
"End If" & Chr(13) & _
"End If" & Chr(13) & _
"End Sub"
End With
'-------------------------------------

Above is my code. It adds lines of code inside a module.
If I need to add more lines to the module I am adding
lines to by using this code, which in turn will mean I
need to add more lines of code to this code (code above),
would I be able to do this?


-----Original Message-----
Hey guys


I am getting the error "Too many line continuations" when
I try to add another line. I have 24 line continuations
and when I try to add a 25th, I get the error. Does
anyone know a work around because it just so happens I

was
able to get it to only 24 lines but in the future, I may
need 25 or more.


Thank you
Todd Huttenstine
.





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
Continuation of a macro Dan Wood Excel Discussion (Misc queries) 2 December 20th 09 11:54 AM
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
formula continuation with the paint too. Fay New Users to Excel 2 March 17th 08 10:56 PM
continuation from yesterday Mindy Excel Discussion (Misc queries) 4 June 22nd 06 11:13 PM


All times are GMT +1. The time now is 01:15 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"