+ Reply to Thread
Results 1 to 5 of 5

Excel+macro: Print based on range values

  1. #1
    Registered User
    Join Date
    10-28-2017
    Location
    LISBON, PORTUGAL
    MS-Off Ver
    office 2013
    Posts
    3

    Excel+macro: Print based on range values

    Hello I'm having some difficult to find the right code for the following goal:

    I have a sheet with a macro that when i change a value in the cell E5, automatically fill certain fields in sheet1, searches and return values from a table on other sheet - sheetTable). So after changing cell E5, sheet1 is basically ready to print.

    My goal is to select a range of values in a collumn on sheetTable and assign each one of them to Cell E5 on sheet1, and print each one.

    So lets say I select 3 cells with values: 45, 50 and 66. When I run the macro it will assign 45 to cell E5 and print sheet1, then it will assign 50 to cell E5 and print sheet1 and finally will assign 66 to cell E5 and print sheet1.

    Also, I need to print each ones in PDF and the resulting PDF filename should be the value of E5 cell [basically something like range(e5).value.pdf].

    Can anyone help me plz?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel+macro: Print based on range values

    Seems like this should do it, with some edits on your part:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-28-2017
    Location
    LISBON, PORTUGAL
    MS-Off Ver
    office 2013
    Posts
    3

    Re: Excel+macro: Print based on range values

    Hi. Thanks for the help but there is something wrong on the code...
    it returns me run-time error '438' on line

    For Each cell In ActiveSheet.Selection

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel+macro: Print based on range values

    Maybe, assuming the sheet with the selected cells are onscreen:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-28-2017
    Location
    LISBON, PORTUGAL
    MS-Off Ver
    office 2013
    Posts
    3

    Re: Excel+macro: Print based on range values

    All done! Thank you for your help

+ 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 to print a specific range in Excel 2016 for Mac
    By jsagolf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-03-2016, 02:30 PM
  2. [SOLVED] Macro to Print Range based off of Cell Value
    By Chris McGlothen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2016, 08:52 PM
  3. [SOLVED] Need ‘Set Print Area’ Code for Dynamic Print Range based on Conditions
    By dosbirn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2013, 12:13 PM
  4. Need help making a macro to copy range of values based on cell values.
    By zolton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2013, 08:58 AM
  5. Filter & Print based on values in a range
    By Pergo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2013, 02:39 PM
  6. Need Macro To Sort and Print WorkSheet Based On Values Of Cells
    By NHD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2012, 04:08 AM
  7. macro to print worksheet based on value in range of cells
    By mugs62 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-29-2009, 11:52 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