+ Reply to Thread
Results 1 to 7 of 7

Printing Based on Name Box Ranges

  1. #1
    Registered User
    Join Date
    07-10-2019
    Location
    United States
    MS-Off Ver
    2016
    Posts
    10

    Printing Based on Name Box Ranges

    I am trying to write a macro or VBA, whichever is easier (right now feels like macro is) to create a print button that applies print parameters based on the ranges specified in the "Name Box" (box in the top left), based on the last 3 letters of the name, the sheets page layout, print settings and such will vary but I can't figure out how to get VBA to pay attention to the letters in the "Name Box", identify them, and print based on what letters it finds in the last three positions/whether or not they are contained. Could use a hand here, big thanks if anyone can help. Side note, workarounds are a bit of a challenge here, the only way I could find to define each range is with that name box, they need to be comingled within a sheet so I can't make a sheet for each one. The best way I could think was to make a temporary sheet with the range represented by the name, print that sheet with the parameters I need, and then delete that sheet.

  2. #2
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Printing Based on Name Box Ranges

    Hi, hard to visualise without a sample sheet. Been a long time since I've done any vba macros but, since it's been a couple of hours since you posted this, I'll just give some general thoughts. I get the impression that each "Name" will be an area within the same worksheet. Can you set up an array (or even just a vlookup table) so that when you press the "Print" button it looks up the name and finds the appropriate print range to apply?

  3. #3
    Registered User
    Join Date
    07-10-2019
    Location
    United States
    MS-Off Ver
    2016
    Posts
    10

    Re: Printing Based on Name Box Ranges

    Attachment 637081Attachment 637082Attachment 637083
    There is an AOP and CHP for each tab (ie Ex1AOP, Ex2AOP) and they refer to a set range which I want to be treated as a print range. In a perfect world, the VBA would "look through" the available names, find one that has 0< "AOP" and those that meet that are printed. I have the print side figured out just not the finding the correct range side.

  4. #4
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Printing Based on Name Box Ranges

    Your attachments are an invalid type and I can't see them. Please attach a sample workbook so we can not only see what you're talking about, but can experiment with our formulae without having to type in all the data ourselves.

  5. #5
    Registered User
    Join Date
    07-10-2019
    Location
    United States
    MS-Off Ver
    2016
    Posts
    10

    Re: Printing Based on Name Box Ranges

    Hope this helps, left in what I was working on but its honestly kind of a mess.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Printing Based on Name Box Ranges

    That's a great start, posting a workbook I mean
    I'm guessing that pressing the "Print AOP" button is meant to search all other sheets (ex1,ex2,ex3, etc) and print the desired range within each worksheet depending if it meets your criteria.
    I can see what you want, but I feel its been way too long since I've used VBA to help you without spending hours, that I don't have, to re-learn
    Now that you've posted an example sheet and explained a bit of what you need, I think one of the VBA experts can join in and help.
    It would be of benefit to see some data on the other sheets to get an idea of the kind of ranges your wish to print, including examples of what does and does not meet the criteria for printing.

    It sounds very doable, I think I did something similar about a decade ago, so you shouldn't have any trouble finding one of these great volunteers to help out.

    Good Luck! :D

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Printing Based on Name Box Ranges

    I'm not sure you can use a name box change event to trigger a macro but see if the following in attached workbook is workable

    In a Userform with a listbox
    Please Login or Register  to view this content.
    in an ordinary module

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by nigelog; 08-15-2019 at 04:35 AM.

+ 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. [SOLVED] printing named ranges
    By StrawberryFields in forum Excel General
    Replies: 3
    Last Post: 08-02-2013, 06:18 AM
  2. Printing area with 2 ranges
    By nelia in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2012, 10:15 AM
  3. Printing an array of ranges
    By LAMoore in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2012, 10:26 AM
  4. Setting Dynamic Ranges for Printing or not Printing
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-06-2011, 02:22 PM
  5. Printing several ranges on one sheet
    By nbuk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-08-2010, 03:07 AM
  6. Auto printing in ranges
    By torpido in forum Excel General
    Replies: 1
    Last Post: 05-31-2010, 08:58 AM
  7. [SOLVED] printing Union of Ranges
    By anny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-26-2006, 06:25 AM
  8. [SOLVED] Printing ranges not remembered
    By Shelagh in forum Excel General
    Replies: 0
    Last Post: 01-20-2006, 05:45 AM

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