+ Reply to Thread
Results 1 to 9 of 9

Hide Page break 2

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Hide Page break 2

    Hi Guys,
    I have page breaks in every excel sheet (Page 1,Page 2) set for printing purposes.
    Any way to hide all contents in everysheet starting with the 2nd page(meaning to display just the 1st page break) in every sheet?

    I need this to be active for all sheets except Other
    This is my code:


    For Each ws in application.activeworkbook.worksheets
    if ws.name <> ("Other") Then:

    -----------------------
    Thanks!

  2. #2
    Registered User
    Join Date
    10-12-2017
    Location
    Brazil
    MS-Off Ver
    2016
    Posts
    59

    Re: Hide Page break 2

    Hello.

    See if it helps.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Hide Page break 2

    Hi ,
    Thanks for the reply!
    The issue is that I have 2 pages(in each sheet) so what your code will do is hide all sheets other than "other"

    What I would like to do is hide the 2nd page in each sheet and keep the 1st page.
    The reason I want to do it is because in some sheets the 2nd sheet does not contain any data so I wouldn't like to view it at all.
    Thanks

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Hide Page break 2

    Hi Vadimchik,

    Great question. For your specific question, the solution is relatively simple, but for the general case a little more complicated. Issues for the general case include:
    a. Blank Sheet (no Print Area)
    b. Sheet using the default Print Area (Print Area never defined by the User)
    c. Sheet where Page 1 is not in Cell 'A1'.
    d. Non-standard Print Area (not addressed here)

    See the attached file that contains the following code in ordinary code module ModDisplayHidePages2ThruN:
    Please Login or Register  to view this content.
    Lewis

  5. #5
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Hide Page break 2

    Wow, thanks Lewis. Looks great, although more code than I anticipated. Won't that affect runtime when having 49 sheets ?

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Hide Page break 2

    It was relatively quick with the six small sheets. Runtime with 49 sheets should be 5 seconds or less.

  7. #7
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Hide Page break 2

    Thanks Lewish,
    Really helpful and beautifully explained!

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Hide Page break 2

    This could be qualifies as one of the simple solutions, as Lewis alluded to.
    Please Login or Register  to view this content.
    Note:No error checking in the code.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

+ 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. Trying to count rows from manual page break to manual page break
    By LuckoftheLefty in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2014, 06:53 AM
  2. 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
  3. [SOLVED] Page Layout (Page Break Preview) is not working with hidden rows in excel.
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2013, 03:32 AM
  4. Vertical Page Break / Column Break
    By kmg2424 in forum Excel General
    Replies: 0
    Last Post: 07-27-2010, 08:10 AM
  5. need page break by asking the input file for page break to be done
    By saikumar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-10-2008, 07:33 AM
  6. Page Break-What would cause a page break not to be moved?
    By HT in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-21-2005, 03:05 PM
  7. adding a new page break to an existing page break
    By Edward Letendre in forum Excel General
    Replies: 1
    Last Post: 03-06-2005, 06:06 AM

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