+ Reply to Thread
Results 1 to 5 of 5

break page for each range based on ending of month

  1. #1
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    break page for each range based on ending of month

    Hello,

    I search for macro to create break page for each range based on ending of month into first sheet . so the range is from column A: H . the column A is date DD\MM\YYYY .

    so when end the date for each month for each range like 28 or 30 or 31 , then should break page after number of ending for that month for each range separately from the beginning to end and move to next range and create break page based on number of ending for that month so on .
    currently this macro doesn't do what I want it .
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,408

    Re: break page for each range based on ending of month

    The code works for me: but change orientation to Landscape.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: break page for each range based on ending of month

    but change orientation to Landscape.
    thank, but why now works when change as in your proposition and even if I return to orientation ?

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this ...


    Quote Originally Posted by Alaa-A View Post
    so when end the date for each month for each range like 28 or 30 or 31[…]
    According to your attachment as this is not the appropriate way to go so try this starter Excel basics VBA demonstration :

    PHP Code: 
    Sub Demo1()
               
    Dim Rf As Range
        With ActiveSheet
    .UsedRange.Columns(1)
               
    Set Rf = .Find("DATE", [A1], xlValues1)
            If 
    Not Rf Is Nothing Then
                
    Do
                  .
    Parent.HPageBreaks.Add Rf
                       Set Rf 
    = .FindNext(Rf)
                
    Loop Until Rf.Row 1
                       Set Rf 
    Nothing
            End 
    If
        
    End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 03-27-2023 at 07:26 AM.

  5. #5
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: break page for each range based on ending of month

    thanks Marc for the code works as I want it .

+ 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. Move Page Break 1 cell up if bullet-point is in on the page break.
    By saudi_red_neck in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2019, 10:24 AM
  2. auto page break around cell range so as not to print a range across 2 pages
    By lonemascot in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-08-2016, 04:48 PM
  3. [SOLVED] Calculation of days per month for dates beginning in one month and ending in another month
    By Fahrettin in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-07-2015, 04:52 PM
  4. Find First match value and add page break, findnext value and add page break
    By dwx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2013, 12:58 PM
  5. Formula for average duration for each month based on the ending month
    By bobby769 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-21-2013, 11:18 AM
  6. [SOLVED] Help creating a date range with beginning and ending days of the month.
    By charlesbb88 in forum Excel General
    Replies: 6
    Last Post: 04-27-2012, 09:28 PM
  7. [SOLVED] Page Break based on Dates
    By Dan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2005, 04:06 PM

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