+ Reply to Thread
Results 1 to 3 of 3

Runtime Error When Using Macro to Set Print Area by Cell Value

  1. #1
    Registered User
    Join Date
    12-17-2020
    Location
    Winnipeg
    MS-Off Ver
    2016
    Posts
    2

    Runtime Error When Using Macro to Set Print Area by Cell Value

    Long-time reader, first-time poster.

    I have this bit of code that is supposed to set the print area of my worksheet based on the values in column K.
    I want to print a portion of the sheet, starting at D1, up to and including K1, and finishing when it hits the first cell that contains "C: Closed".
    A3:W131 is set up as a table.
    I attached a sample version if that helps see the problem in context. Using Excel 2016.


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: Runtime Error When Using Macro to Set Print Area by Cell Value

    You know that none of the cells contain "C: Closed"? A couple contain "C. Closed"

    I'd suggest:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    12-17-2020
    Location
    Winnipeg
    MS-Off Ver
    2016
    Posts
    2

    Re: Runtime Error When Using Macro to Set Print Area by Cell Value

    Good catch on the C. vs C:, although the error happened even if I changed the Find value, which I had tested previously.

    Your recommended change worked beautifully, and I was able to implement it with no further errors! Thanks for the quick reply.

+ 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 checking if specific cell is empty every 5 rows, if so- set print area.
    By karajakatak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2020, 07:26 PM
  2. Macro to set multiple print area based on cell values
    By acarter21 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2019, 07:22 AM
  3. Macro - Set Print Area for Changing Data Area
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2013, 04:19 AM
  4. Macro error : Method 'print area' of object 'page setup' failed.
    By aka189 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-25-2012, 10:54 AM
  5. Replies: 2
    Last Post: 01-20-2010, 02:47 AM
  6. Variable Print Area Macro Based on Cell Value
    By cuclay in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2009, 08:26 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