New line of code.. same argument?

D

Derrick

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.
 
R

Rick Rothstein

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).
 
D

Derrick

not quite. in VBA... its like this:
if a>b or c>d or e>f or g>h 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 where:
if A>b or
c>d or
.... than
?
 
R

Rick Rothstein

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top