Conditional Formatting Question inside... :)
Prep for a pre-employment Excel test with Job Test Prep
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Conditional Formatting Question inside... :)

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hello. Excel '97 here...

    What I have is a three-column sheet where the second column is filled with one of around 10 names.

    I need to know how to insert a page break (automatically) when the name in the second column changes (for example...if the first three rows have Jones as the name in the second column and then the next row has Smith, I need for it to insert a page break because the name changed).

    I understand how to insert a page break by hand but I'm trying to automate this process.

    Thanks in advance for any assistance anyone might can offer!

    BEEK

    "Everyone will have eternal life...where will you spend yours?"

    [ This Message was edited by: BEEK on 2002-03-14 11:47 ]

    [ This Message was edited by: BEEK on 2002-03-14 11:49 ]

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try using the following code where a1 is the location of the first name:
    Range("a1").Select
    For i = 1 To 10
    If Not ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
    ActiveWindow.SelectedSheets.HPageBreaks.Add before:=ActiveCell.Offset(1, 0)
    End If
    ActiveCell.Offset(1, 0).Select
    Next i
    End Sub

    I hope this helps.
    Kind regards, Al.

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks Al Chara...that code works beautifully...

    BEEK

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com