+ Reply to Thread
Results 1 to 6 of 6

Macro to Set Print Area and Print Report

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Macro to Set Print Area and Print Report

    I am looking to create a macro that dynamically sets the print area based upon the farthest column and last row. The furthest column out with text will be columnJ but the last row is variable to the amount of data put into the worksheet. As well after the first page I would like "Row16" to remain a header row for the rest of the pages. The goal would be to use say "Commandbutton1" to set the print area and print the report.

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Macro to Set Print Area and Print Report

    steps:
    1. record macro for your steps in defining the print area, selecting header row, and print
    2. to get the last row use this code in VBA
    Please Login or Register  to view this content.
    Click on the star if you think I helped you

  3. #3
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Macro to Set Print Area and Print Report

    Thanks adyteo

  4. #4
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Macro to Set Print Area and Print Report

    Bump for any help in creating the full macro.

  5. #5
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Macro to Set Print Area and Print Report

    This is what I got so far: With Custom Margins of .2 Top/Bottom and .25 on the Sides and Set to "Fit Columns to Page" is there anyway I can get this statements in the code so if the user doesn't have the right settings it will adjust?

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Macro to Set Print Area and Print Report

    if you record the macro when you setup the margins of the page, you will also get the settings.

    I have setup (an example) with 5 points for header/footer and 8 points for left/right margins. this is the code oyu need to insert just before ActiveWindow.SelectedSheets.PrintOut

    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. VBA to set print range, open box asking for print qty, print, then redefine print area
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:43 PM
  2. [SOLVED] Pivot Table macro to set print area and print details of drill down data
    By Steve Haskins in forum Excel General
    Replies: 2
    Last Post: 12-28-2005, 01:10 PM
  3. [SOLVED] Create a print macro that would automatically select print area?
    By wastedwings in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  4. [SOLVED] Create a print macro that would automatically select print area?
    By wastedwings in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  5. Create a print macro that would automatically select print area?
    By wastedwings in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-22-2005, 06:05 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