ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   New line of code.. same argument? (https://www.excelbanter.com/excel-programming/432068-new-line-code-same-argument.html)

Derrick

New line of code.. same argument?
 
hi. i have a reallly long line of code - big if / or statement.. is there a
way to make it look nicer by bringing it down a row? thanks.


Rick Rothstein

New line of code.. same argument?
 
I'm not sure what you are asking here. If you mean you want to move the
formula, as is, to a different cell... select the entire formula in the
Formula Bar, Cut it (Ctrl+X), then select the cell you want it in and Paste
it there (probably best to Paste it into the Formula Bar).

--
Rick (MVP - Excel)


"Derrick" wrote in message
...
hi. i have a reallly long line of code - big if / or statement.. is
there a
way to make it look nicer by bringing it down a row? thanks.



Derrick

New line of code.. same argument?
 
not quite. in VBA... its like this:
if ab or cd or ef or gh then but A-h are longer cell references -
range("A"&target.Row)
so it goes way out to the right side.
can i do something whe
if Ab or
cd or
.... than
?

"Rick Rothstein" wrote:

I'm not sure what you are asking here. If you mean you want to move the
formula, as is, to a different cell... select the entire formula in the
Formula Bar, Cut it (Ctrl+X), then select the cell you want it in and Paste
it there (probably best to Paste it into the Formula Bar).

--
Rick (MVP - Excel)


"Derrick" wrote in message
...
hi. i have a reallly long line of code - big if / or statement.. is
there a
way to make it look nicer by bringing it down a row? thanks.




Rick Rothstein

New line of code.. same argument?
 
VB has a Line Continuation character sequence you can use to do this. Just
put a space character followed by a underline character at any natural
breakpoint (that is, **not** in the middle of any keywords or text
constants) and then hit the Enter key to move to the next line and continue
your code there. For the sample statement you gave, it would look like
this...

If A B Or _
C D Or _
E F Or _
G H Then

Here is a link that explains it in a little more detail...

http://support.microsoft.com/kb/141513

--
Rick (MVP - Excel)


"Derrick" wrote in message
...
not quite. in VBA... its like this:
if ab or cd or ef or gh then but A-h are longer cell references -
range("A"&target.Row)
so it goes way out to the right side.
can i do something whe
if Ab or
cd or
... than
?

"Rick Rothstein" wrote:

I'm not sure what you are asking here. If you mean you want to move the
formula, as is, to a different cell... select the entire formula in the
Formula Bar, Cut it (Ctrl+X), then select the cell you want it in and
Paste
it there (probably best to Paste it into the Formula Bar).

--
Rick (MVP - Excel)


"Derrick" wrote in message
...
hi. i have a reallly long line of code - big if / or statement.. is
there a
way to make it look nicer by bringing it down a row? thanks.






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com