+ Reply to Thread
Results 1 to 8 of 8

Macro to Adjust Print Area

  1. #1
    Registered User
    Join Date
    01-03-2007
    Posts
    17

    Macro to Adjust Print Area

    Hi, can someone please help me create a macro that automatically adjusts the print area of a worksheet based on a formula-driven cell value?

    For example, say cells B2:K5 are full of vlookups that return percentage values while column A calculates the sum of the percentages (A2=sum(B2:K2). A1:K1 have column headers.

    If I sort the worksheet by column A in decending order, I want the print area to only cover those rows where the value in column A is greater than 5%.

    If for example, rows A2 and A3 are greater than 5%, I want the print area to include A1 to K3. I hope this makes sense. Thank you in advance for any help!

  2. #2
    Forum Contributor
    Join Date
    10-01-2007
    Posts
    101
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-01-2007
    Posts
    101
    sorry

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-03-2007
    Posts
    17
    thanks for the help, but it doesn't seem to work. Here's the macro and I've attached a sample workbook (without the vlookups).

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

  5. #5
    Forum Contributor
    Join Date
    10-01-2007
    Posts
    101
    yea sorry. i had it working before i posted but then shut my book before saving. Its not working for me either.

  6. #6
    Registered User
    Join Date
    01-03-2007
    Posts
    17
    no worries, thanks for trying. Does anyone else have a suggestion?

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 07-16-2008 at 08:53 AM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  8. #8
    Registered User
    Join Date
    01-03-2007
    Posts
    17
    I probably did something wrong...but running that macro didn't do anything. I think I have an idea why though, and I'll try to get it to work tomorrow. Thanks for the help and I'll provide an update soon.

    Assuming this doesn't work, are there any PrintArea macros that don't rely on Auto-filters? Perhaps another route would be to create a macro that:
    1. Selects the rows where the value in column b is greater than 5%
    2. Automatically adjusts the print area to include those rows
    3. and then prints the file

    Thoughts?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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