+ Reply to Thread
Results 1 to 7 of 7

Print Macro for Range Defined in Cell

  1. #1
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Print Macro for Range Defined in Cell

    Hello,
    I am trying to put a print macro into a worksheet. What makes this unique is that the sheet will have 3 different print areas that I need to account for (all 8.5 x 11).
    The sheet is still a work in progress and may change so the most flexible way would be to have a cell on the sheet (AL5) where I can put in the print area manually (or by formula) and the macro will pick this up as the print area.

    For instance, I would like the value in cell AL5 to be “B7:H70”. The macro would then find this range and print 8.5x11 of this range. I would then have another print macro in the same worksheet that would reference a different range in AL6, (say J5:V66)

    Is this an easy solution? Thank you in advance.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Print Macro for Range Defined in Cell

    ? Try:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Print Macro for Range Defined in Cell

    Hi Porucha! Thank you for the reply. My apologies for lack of understanding macro language. I've attached a scaled down version of the workbook I am working in. The idea is that the worksheet (123-Main) will be copied and pasted numerous times so the macro needs to be for the active sheet. A button for each print area per sheet can work. (The attached shows the buttons). The ranges for each section are in AL5-AL7. Is there a way that the macro can reference these cells and use the values in these cells to determine the print range?

    Thank you again for the reply.
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Print Macro for Range Defined in Cell

    How about this one ? It works on the active sheet.
    Select the cell with the desired printarea when asked.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Print Macro for Range Defined in Cell

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

  6. #6
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Print Macro for Range Defined in Cell

    Thank you Bakerman2. I like this macro but the manual entry for print range will not work for this application since there may be up to 30-40 of these worksheets.

  7. #7
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Print Macro for Range Defined in Cell

    Hi Porucha,
    This is closer to what I am looking for. One issue appears that if I try to adjust the ranges in say cell AL5 to say B7:V76 (as a pressure test), the print does not expand to that range. It seems the existing range that can be seen when one hits the "Page Break Preview" overrides this new range in cell AL5. (changing print area 3 to include more rows seems to work though). Thoughts?

    Thanks

+ 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. Print Cells from Defined Name Range
    By BLS99covert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2014, 11:48 PM
  2. VBA Macro - Copying entire row from selected cell (within a pre-defined range)
    By ginja in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-22-2014, 09:34 AM
  3. [SOLVED] macro to select cell with data in from defined range
    By will.girling in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-25-2014, 01:20 PM
  4. Build and print a daily report with defined date range
    By soc.com in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-18-2013, 06:16 AM
  5. [SOLVED] Macro to copy a cell range and paste to a new sheet 'n' times where 'n' defined by formula
    By staminaboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:39 AM
  6. Macro to Insert defined integer into range defined by variable criteria
    By stereofeedback in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2013, 12:33 PM
  7. User Defined Print Range in VBA
    By mburke05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2013, 05:03 PM

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