Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transpose to break up one long row to many? | Excel Worksheet Functions | |||
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 | Excel Discussion (Misc queries) | |||
One VERY LONG row... break it down? | Excel Discussion (Misc queries) | |||
How to split too long text in one row to break in next row. | Excel Discussion (Misc queries) | |||
How do i break really long bars to show short ones in Excel? | Charts and Charting in Excel |