+ Reply to Thread
Results 1 to 10 of 10

Help with VBA to adjust page break over on column

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Help with VBA to adjust page break over on column

    Can we add something that would make the page break at the end of column C? and to set the page break to stop at the last filled row?

    Please Login or Register  to view this content.

    Edit** Adjusted code to do page break, but when I save as a PDF I get hundreds of blank pages after my data.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by taylorsm; 08-04-2016 at 08:26 AM.

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

    Re: Help with VBA to adjust page break over on column

    I must be missing something.
    Is there a reason why you can't set the print area to what you indicate in your post?
    Something along the lines of
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Help with VBA to adjust page break over on column

    Not missing anything! I had help with the other macro, other than the edit part which i figured out.

    The sheet i begin with looks like the example, except it has 240 duplicates that vary in length. Would work for those too?

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

    Re: Help with VBA to adjust page break over on column

    The only hard coded cell reference is cell A1 (Cells(1, 1)) and Column C (Cells(lr, 3)). The 3 here is Column C.
    The last cell is lr and could be anything.
    If I read it right and you want to export multiple sheets with varying column lengths, you have to let us know because that will change the code in Post #2.

  5. #5
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Help with VBA to adjust page break over on column

    If I highlight all the rows below my text and right click/delete then it fixes everything. Can I add something to my VBA that will do this?

  6. #6
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Help with VBA to adjust page break over on column

    So I adjusted the example and duplicated it. It would look something like this, but have 240 different accounts.

    Sorry, I am re-reading and maybe screwed up a little on the explanation. The example is what my code produces, I start off with something far more complicated, then run this VBA and then my last example workbook is what I end up with. I then have ANOTHER vba that I run and splits my example into three separate worksheets like my original example. So maybe this code isn't the best one to adjust, maybe I need it for the one that actually splits the notepads?
    Attached Files Attached Files
    Last edited by taylorsm; 08-03-2016 at 10:05 PM.

  7. #7
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Help with VBA to adjust page break over on column

    This is pretty close to what I use, couple minor adjustments, but I am not on my work computer with the latest version. Does any of this stand out?

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Help with VBA to adjust page break over on column

    What is your end goal?
    From Book2 export Range A1:C12 to PDF, Range A13:C36 To PDF and A37:C51 to PDF?

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

    Re: Help with VBA to adjust page break over on column

    See attached. Is this what you have in mind?
    Explanation is in the workbook.
    Attached Files Attached Files
    Last edited by jolivanes; 08-05-2016 at 02:24 AM. Reason: Add info

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

    Re: Help with VBA to adjust page break over on column

    You could try this also.
    Tailored for your Book2 example only
    Please Login or Register  to view this content.

+ 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. MACRO - Page Break when a column changes
    By jaime81 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2013, 02:34 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] Print page break after column change
    By dlorenzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2012, 03:55 PM
  4. Vertical Page Break / Column Break
    By kmg2424 in forum Excel General
    Replies: 0
    Last Post: 07-27-2010, 08:10 AM
  5. [SOLVED] any way to redisplay column headings after page break?
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 12:05 PM
  6. [SOLVED] any way to redisplay column headings after page break?
    By Gerald Morris in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  7. any way to redisplay column headings after page break?
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 AM
  8. [SOLVED] any way to redisplay column headings after page break?
    By Gerald Morris in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 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