Consulting

Results 1 to 4 of 4

Thread: Insert Page Break when values change

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    35
    Location

    Insert Page Break when values change

    Hi All,

    I need to place a page break after values change in Col B. Does anyone have a snipit of code, I can pop in?

    Thx

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    And where would the page break go; below the last used cell in col B?

    Is it a vertical or horizontal break?

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    35
    Location
    Quote Originally Posted by GTO
    And where would the page break go; below the last used cell in col B?

    Is it a vertical or horizontal break?
    The page break would be horizontal and be placed between the cells with different values.
    Thanks

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings Nosstech,

    ...page break after values change in Col B...
    ...and be placed between the cells with different values...
    According to your first descript, every time a value changes in any cell in column B, a pager break should be inserted somewhere...

    And per the the second descript, if B1 = 5, B2 = 934, B3 = 909, etc - there would be a page break at each row.

    Here is a horizontal page break between rows 30 and 31, on Sheet1 (codename, not tab name).

    [vba]Sheet1.HPageBreaks.Add Before:=Sheet1.Cells(31, 1)[/vba]

    I would suggest attaching an example workbook and a better description of what is likely to be happening. IE - There are several different ranges in Col B and users may be inserting rows as they enter data, or, There is one contiguoius range, or etc.

    This way someone could probably provide a solution as to resetting page breaks as necessary...

    Hope this helps,

    Mark

Posting Permissions

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