Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Add a page break (Excel xp)

    I am searching for the word #page and want to add a page break before the row it finds it in. #page will always occur in column A. This line doesn't seem to work even tho i don't get an error ...rngCell.HPageBreaks.Add Before:=ActiveCell

    What object has the HPageBreaks property? Thank you

    Set rngTC = ActiveSheet.Columns("A:A").SpecialCells(xlTextValu es)
    If rngTC Is Nothing Then Exit Sub
    For Each rngCell In rngTC
    If InStr(LCase(rngCell.Value), "#page") > 0 Then
    rngCell.HPageBreaks.Add Before:=ActiveCell
    End If
    Next rngCell

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Add a page break (Excel xp)

    Pagebreaks are a Property of the Sheet Object, not a Cell Object. Try

    ActiveSheet.HPageBreaks.Add Before:=rngCell
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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