+ Reply to Thread
Results 1 to 4 of 4

macro to insert page break when value in row changes

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Yorkshire England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Exclamation macro to insert page break when value in row changes

    Hi I need a macro that will insert a page break when the value in column A changes I have a list of around 95 numbers with approx 78 rows of data for each number though this will vary, there is a macro in there that used to work but longer does this macro was

    Sub PageBreak()
    Dim RNG As Range
    Dim CurrNM As String

    CurrNM = Range("A1").Value
    For Each RNG In Range("A1", Range("A65536").End(xlUp))
    If Not (CurrNM = RNG.Value Or RNG = "") Then
    CurrNM = RNG.Value
    ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=RNG
    End If
    Next RNG
    End Sub

    any help would be greatly appreciated this is a report I have to run daily and is currently taking a ream of paper a day
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: macro to insert page break when value in row changes

    I did not understand what you want, the value in column A changes in each row
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    01-21-2013
    Location
    Yorkshire England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: macro to insert page break when value in row changes

    sorry I mean column A when it changes from 1 to 2 then 3, 4 etc (this is the store number.

  4. #4
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2010
    Posts
    290

    Re: macro to insert page break when value in row changes

    Hi,

    use below code

    Please Login or Register  to view this content.
    Happy to Help

    VISHA

    Click *, if the suggestion helps you!
    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>> "Mark your thread as Solved"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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