Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Dec 2004
    Location
    Stoney Creek, Ontario
    Posts
    196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Break long line of code (2003)

    HI all. How do I break a long line of code so I don't have to scroll left and right to read it?

    Thanks!

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Break long line of code (2003)

    Enter a space and an underscore character:

    'Very long line of code part 1 _
    Remainder of very long line (part 2)
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Break long line of code (2003)

    Insert a space and an underscore then press Enter:
    <code>
    MsgBox "Do you want to continue?", _
    vbQuestion + vbYesNo
    </code>
    or
    <code>
    Range("A4").Value = Range("A1").Value + _
    Range("A2").Value
    </code>
    Indenting the second line (and subsequent ones) is not obligatory, but it makes the code easier to read.

  4. #4
    2 Star Lounger
    Join Date
    Dec 2004
    Location
    Stoney Creek, Ontario
    Posts
    196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Break long line of code (2003)

    Many thanks to both!

Posting Permissions

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