Closed Thread
Results 1 to 10 of 10

Continue line of VBA code on the next line

  1. #1
    Registered User
    Join Date
    03-10-2005
    Location
    East Greenbush, NY
    Posts
    26

    Question Continue line of VBA code on the next line

    I have a really long formula I am trying to set a cell value to.

    Is there a way to break the code up over several lines to make it more readable and help me debug?

    TIA!

    Heather.

    Heather Linsk
    h l i n s k @ g m a i l . c o m

  2. #2
    Roman
    Guest

    Re: Continue line of VBA code on the next line

    Hi Peacelittleone,
    the way is like this:

    first part of something _
    second part of something _
    third part of the thing

    Note there's a break before each _


  3. #3
    Roman
    Guest

    Re: Continue line of VBA code on the next line

    there's a blank space before each _

    (still working on my english..)


  4. #4
    Tom Ogilvy
    Guest

    Re: Continue line of VBA code on the next line

    If you mean formula and not VBA code, then I don't believe you can.
    General approach is to put complete subelements of the formula in separate
    cells and get these working individually, then start combining them.


    --
    Regards,
    Tom Ogilvy

    "peacelittleone"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a really long formula I am trying to set a cell value to.
    >
    > Is there a way to break the code up over several lines to make it more
    > readable and help me debug?
    >
    > TIA!
    >
    > Heather.
    >
    >
    > --
    > peacelittleone
    >
    >
    > ------------------------------------------------------------------------
    > peacelittleone's Profile:

    http://www.excelforum.com/member.php...o&userid=20937
    > View this thread: http://www.excelforum.com/showthread...hreadid=381939
    >




  5. #5
    Roman
    Guest

    Re: Continue line of VBA code on the next line

    Well if you mean formula than you can do one thing:

    write the formula in Notepad on as many rowd as you need and then copy
    it into formula bar (click into formula bar paste the formula text).

    This works for me in MS Excel 2000


  6. #6
    Tom Ogilvy
    Guest

    Re: Continue line of VBA code on the next line

    I see you did say VBA code in the subject. this just emphasizes that you
    should put all the pertinent information in the body of your question to
    minimize misinterpretation.

    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > If you mean formula and not VBA code, then I don't believe you can.
    > General approach is to put complete subelements of the formula in separate
    > cells and get these working individually, then start combining them.
    >
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "peacelittleone"
    > <[email protected]> wrote in
    > message

    news:[email protected]...
    > >
    > > I have a really long formula I am trying to set a cell value to.
    > >
    > > Is there a way to break the code up over several lines to make it more
    > > readable and help me debug?
    > >
    > > TIA!
    > >
    > > Heather.
    > >
    > >
    > > --
    > > peacelittleone
    > >
    > >
    > > ------------------------------------------------------------------------
    > > peacelittleone's Profile:

    > http://www.excelforum.com/member.php...o&userid=20937
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=381939
    > >

    >
    >




  7. #7
    GB
    Guest

    RE: Continue line of VBA code on the next line

    Another way is that while you are typing in the information to the cell, that
    if you press Alt-Enter at each point you would like to establish a break,
    then it will give you a new line for each Alt-Enter performed.

    This is what copying to the notepad is similar to, but without going to an
    outside utility. I think though also, that each Enter is counted as a
    character against the total number of characters that can be entered into the
    cell, so keep that in mind also.



    "peacelittleone" wrote:

    >
    > I have a really long formula I am trying to set a cell value to.
    >
    > Is there a way to break the code up over several lines to make it more
    > readable and help me debug?
    >
    > TIA!
    >
    > Heather.
    >
    >
    > --
    > peacelittleone
    >
    >
    > ------------------------------------------------------------------------
    > peacelittleone's Profile: http://www.excelforum.com/member.php...o&userid=20937
    > View this thread: http://www.excelforum.com/showthread...hreadid=381939
    >
    >


  8. #8
    Tom Ogilvy
    Guest

    Re: Continue line of VBA code on the next line

    You also might need to remove them to use the formula.

    --
    Regards,
    Tom Ogilvy


    "GB" <[email protected]> wrote in message
    news:[email protected]...
    > Another way is that while you are typing in the information to the cell,

    that
    > if you press Alt-Enter at each point you would like to establish a break,
    > then it will give you a new line for each Alt-Enter performed.
    >
    > This is what copying to the notepad is similar to, but without going to an
    > outside utility. I think though also, that each Enter is counted as a
    > character against the total number of characters that can be entered into

    the
    > cell, so keep that in mind also.
    >
    >
    >
    > "peacelittleone" wrote:
    >
    > >
    > > I have a really long formula I am trying to set a cell value to.
    > >
    > > Is there a way to break the code up over several lines to make it more
    > > readable and help me debug?
    > >
    > > TIA!
    > >
    > > Heather.
    > >
    > >
    > > --
    > > peacelittleone
    > >
    > >
    > > ------------------------------------------------------------------------
    > > peacelittleone's Profile:

    http://www.excelforum.com/member.php...o&userid=20937
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=381939
    > >
    > >




  9. #9
    GB
    Guest

    Re: Continue line of VBA code on the next line

    I tried creating an if formula, using the alt-enter technique, and the
    formula worked, I had it set up like this:

    =if(
    B1<>"",
    "Hello",
    "Goodbye"
    )

    And worked, no errors.
    Though it would not have worked, if I hadn't gone back and remembered to put
    the commas in that I was originally missing.


    "Tom Ogilvy" wrote:

    > You also might need to remove them to use the formula.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "GB" <[email protected]> wrote in message
    > news:[email protected]...
    > > Another way is that while you are typing in the information to the cell,

    > that
    > > if you press Alt-Enter at each point you would like to establish a break,
    > > then it will give you a new line for each Alt-Enter performed.
    > >
    > > This is what copying to the notepad is similar to, but without going to an
    > > outside utility. I think though also, that each Enter is counted as a
    > > character against the total number of characters that can be entered into

    > the
    > > cell, so keep that in mind also.
    > >
    > >
    > >
    > > "peacelittleone" wrote:
    > >
    > > >
    > > > I have a really long formula I am trying to set a cell value to.
    > > >
    > > > Is there a way to break the code up over several lines to make it more
    > > > readable and help me debug?
    > > >
    > > > TIA!
    > > >
    > > > Heather.
    > > >
    > > >
    > > > --
    > > > peacelittleone
    > > >
    > > >
    > > > ------------------------------------------------------------------------
    > > > peacelittleone's Profile:

    > http://www.excelforum.com/member.php...o&userid=20937
    > > > View this thread:

    > http://www.excelforum.com/showthread...hreadid=381939
    > > >
    > > >

    >
    >
    >


  10. #10
    Tom Ogilvy
    Guest

    Re: Continue line of VBA code on the next line

    Obviously I tried as well and it didn't

    =Sum(C2:C23)

    hit enter and it works

    select right after SUM and do Alt+Enter

    then exit the cell and it shows #Name error.

    You can let Excel correct it, but it puts in a mountain of spaces and some
    extra parens.

    Nonetheless, the OP was apparently talking about VBA code.
    --
    Regards,
    Tom Ogilvy

    "GB" <[email protected]> wrote in message
    news:[email protected]...
    > I tried creating an if formula, using the alt-enter technique, and the
    > formula worked, I had it set up like this:
    >
    > =if(
    > B1<>"",
    > "Hello",
    > "Goodbye"
    > )
    >
    > And worked, no errors.
    > Though it would not have worked, if I hadn't gone back and remembered to

    put
    > the commas in that I was originally missing.
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > You also might need to remove them to use the formula.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "GB" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Another way is that while you are typing in the information to the

    cell,
    > > that
    > > > if you press Alt-Enter at each point you would like to establish a

    break,
    > > > then it will give you a new line for each Alt-Enter performed.
    > > >
    > > > This is what copying to the notepad is similar to, but without going

    to an
    > > > outside utility. I think though also, that each Enter is counted as a
    > > > character against the total number of characters that can be entered

    into
    > > the
    > > > cell, so keep that in mind also.
    > > >
    > > >
    > > >
    > > > "peacelittleone" wrote:
    > > >
    > > > >
    > > > > I have a really long formula I am trying to set a cell value to.
    > > > >
    > > > > Is there a way to break the code up over several lines to make it

    more
    > > > > readable and help me debug?
    > > > >
    > > > > TIA!
    > > > >
    > > > > Heather.
    > > > >
    > > > >
    > > > > --
    > > > > peacelittleone
    > > > >
    > > > >
    > > >

    > ------------------------------------------------------------------------
    > > > > peacelittleone's Profile:

    > > http://www.excelforum.com/member.php...o&userid=20937
    > > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=381939
    > > > >
    > > > >

    > >
    > >
    > >




Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1