Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Break a long row of code

Excel 2002, WinXP
I have a simple copy/paste line of code as this:
ThisRange.Copy ThatRange
This works fine. My problem is that "ThisRange" is actually a long string
to define the range. The same goes for "ThatRange". The result is that I
have a long line of code that stretches way off the screen. As I said, it
works fine, but it's hard to read.
I can usually break up a line of code with an underline character but I
have never been able to do that with a construct such as this.
Is there a way to put this construct on 2 lines? Thanks for your help Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Break a long row of code

Hi,
Using underscore will work:

ThisRange.Copy _
ThatRange

Alternatively do:

Set ThisRange= ........ ' may still need to break with _

Set ThatRange= ......... ' may still need to break with _


ThisRange.Copy ThatRange

HTH


"Otto Moehrbach" wrote:

Excel 2002, WinXP
I have a simple copy/paste line of code as this:
ThisRange.Copy ThatRange
This works fine. My problem is that "ThisRange" is actually a long string
to define the range. The same goes for "ThatRange". The result is that I
have a long line of code that stretches way off the screen. As I said, it
works fine, but it's hard to read.
I can usually break up a line of code with an underline character but I
have never been able to do that with a construct such as this.
Is there a way to put this construct on 2 lines? Thanks for your help Otto



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Break a long row of code

Hi Otto

Sub Tester()
Dim sStr As String
Dim Rng As Range

sStr = "A1: A3 , A5: C7 , E10: F12 , G14: G16" & _
",I20:I22, L1:L3, M5:M7, O10:O12, Q15:Q17, Q22:Q24"
Set Rng = Range(sStr)
Rng.Select

MsgBox Rng.Address
End Sub


---
Regards,
Norman



"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a simple copy/paste line of code as this:
ThisRange.Copy ThatRange
This works fine. My problem is that "ThisRange" is actually a long string
to define the range. The same goes for "ThatRange". The result is that I
have a long line of code that stretches way off the screen. As I said, it
works fine, but it's hard to read.
I can usually break up a line of code with an underline character but I
have never been able to do that with a construct such as this.
Is there a way to put this construct on 2 lines? Thanks for your help
Otto




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Break a long row of code

Idea 1: DIM new range variables Rng1 and Rng2 and set them = the long
strings, and then
Rng1.copy Rng2

Idea 2 - use "With"

With ThisRange
.copy Thatrange
end With


Set the long strings = separately dimmed range variables first, and build
your lines of code using the new variables:
set rng1 = ThisRange
set
Rng1
"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a simple copy/paste line of code as this:
ThisRange.Copy ThatRange
This works fine. My problem is that "ThisRange" is actually a long string
to define the range. The same goes for "ThatRange". The result is that I
have a long line of code that stretches way off the screen. As I said, it
works fine, but it's hard to read.
I can usually break up a line of code with an underline character but

I
have never been able to do that with a construct such as this.
Is there a way to put this construct on 2 lines? Thanks for your help

Otto




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Break a long row of code

Otto,
To break up your lines of code you need to use space underscore " _".
If you omit the space it doesn't work.

Henry


"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a simple copy/paste line of code as this:
ThisRange.Copy ThatRange
This works fine. My problem is that "ThisRange" is actually a long string
to define the range. The same goes for "ThatRange". The result is that I
have a long line of code that stretches way off the screen. As I said, it
works fine, but it's hard to read.
I can usually break up a line of code with an underline character but I
have never been able to do that with a construct such as this.
Is there a way to put this construct on 2 lines? Thanks for your help
Otto




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
Transpose to break up one long row to many? Andym Excel Worksheet Functions 2 February 16th 10 02:18 PM
Interrupting long calculations in Excel? Hi all, I am having a verylong calculation in Excel using VBA. Of course I know I can hit ESC orCTRL+BREAK to interrupt the VBA program. But I found due to too long runningprocess, the Excel window stop to LunaMoon Excel Discussion (Misc queries) 3 July 31st 08 04:47 PM
One VERY LONG row... break it down? Lisa Excel Discussion (Misc queries) 6 October 26th 07 04:56 PM
How to split too long text in one row to break in next row. KrunoCro Excel Discussion (Misc queries) 2 September 14th 05 01:19 PM
How do i break really long bars to show short ones in Excel? nkchu83 Charts and Charting in Excel 2 May 26th 05 07:44 PM


All times are GMT +1. The time now is 09:34 AM.

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"