+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 VBA - Multiple line header adds empty line in between

  1. #1
    Registered User
    Join Date
    10-20-2014
    Location
    The Netherlands
    MS-Off Ver
    2007
    Posts
    29

    Question Excel 2007 VBA - Multiple line header adds empty line in between

    Dear all,

    In Word, you can easily have a header which is two or three lines (rows in Excel terms). However, I seem unable to do the same in Excel as a VBA command or even directly into the LeftHeader from Page Layout view.

    I have used the following code:

    Please Login or Register  to view this content.
    Retrieving the input data for the header from another sheet works fine. FYI, the same problem occurs for the footer. I have a feeling it has to do with the vbNewLine command, but don't know for sure.

    If you delete the empty line from the normal Excel view, it automatically updates it again with a blank line in between.

    Hope someone can help, thanks,

    Chris

  2. #2
    Registered User
    Join Date
    10-20-2014
    Location
    The Netherlands
    MS-Off Ver
    2007
    Posts
    29

    Re: Excel 2007 VBA - Multiple line header adds empty line in between

    I found that if I delete the code from VBA and manually enter the header it does work. Is this something I just have to accept?

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Excel 2007 VBA - Multiple line header adds empty line in between

    Try using vbLf rather then vbNewLine.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    10-20-2014
    Location
    The Netherlands
    MS-Off Ver
    2007
    Posts
    29

    Re: Excel 2007 VBA - Multiple line header adds empty line in between

    Thanks, that's worked a charm!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to Use Before_Print macro to add a multiple line header
    By today2014 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2014, 04:04 PM
  2. Replies: 2
    Last Post: 07-07-2014, 06:48 PM
  3. [SOLVED] If one cell in line turn empty then entire line turns empty
    By Cristy0505 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-19-2013, 06:02 AM
  4. Excel line graph adds 2 cells together - error???
    By Bax1 in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 03-25-2013, 06:37 AM
  5. Difficulty adding a trend line to line graph in Excel 2007
    By jmatoske in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 11-28-2012, 02:59 PM

Tags for this Thread

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