New line of code.. same argument?

  • Thread starter Thread starter Derrick
  • Start date Start date
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.
 
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).
 
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
?
 
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
 
Back
Top