VBA code Line wrap question

G

Guest

I am currently writing a rather long calculation in VBA. Problem with this
is that is scrolls pretty far right so I can't see it easily. How do I break
the code up into multiple lines in VBA? I know how to do it in other
languages, but can't seem to find it in VBA.

example(assume there is no word wrap on this):
I currently have: dblSubTotal = ((aNum(1) * 2) + (aNum(2) * 7) + (aNum(3) *
6) + (aNum(4) * 5) + (aNum(5) * 4) + (aNum(6) * 3) + (aNum(7) * 2))

I need it so that it looks like:
dblSubTotal = ((aNum(1) * 2) + (aNum(2) * 7) +
(aNum(3) * 6) + (aNum(4) * 5) + (aNum(5) * 4) +
(aNum(6) * 3) + (aNum(7) * 2))

Thanks in advance.

James.
 
S

Sandra Daigle

The line continuation character is the underscore which must be preceded by
a space - so your code would look like this:

dblSubTotal = ((aNum(1) * 2) + (aNum(2) * 7) + _
(aNum(3) * 6) + (aNum(4) * 5) + (aNum(5) * 4) + _
(aNum(6) * 3) + (aNum(7) * 2))
 

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