+ Reply to Thread
Results 1 to 3 of 3

Excel macro for creating dynamic print area

  1. #1
    Registered User
    Join Date
    11-20-2020
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    3

    Excel macro for creating dynamic print area

    Hello,

    I'm working on a simple spreadsheet which has to be printed on one page. I wrote a macro in VBA to do this dynamically (removing all empty lines from the print), but I'm having the following issues:

    1) When running the 'MyPrint' macro, I get the printpreview as expected, however, sometimes I get a grey screen instead (see pictures). This can eiter be partially or covering the full screen. Sometimes when I zoom in and out, the grey screen disappears. Does anyone know if there's something wrong in my code?
    2) The program is quite slow, can this be prevented? I'm not sure what the bottleneck is.

    Any help is much appreciated. Thank you in advance.

    Best regards,
    Thomas

    P.s. please find attached pictures and the excel worksheet.

    P.p.s. I copied the macro below, for convenience:

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ThomasJ_; 11-20-2020 at 10:18 AM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Excel macro for creating dynamic print area

    Placing your code between code tags retains all formatting and ensures copy/paste is usable for us to import for verification.

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  3. #3
    Registered User
    Join Date
    11-20-2020
    Location
    The Netherlands
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: Excel macro for creating dynamic print area

    Thank you for your reply. I adjusted my post accordingly

+ 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. Excel Dynamic Print Area based on a value
    By belleroz in forum Excel General
    Replies: 6
    Last Post: 10-08-2019, 08:55 AM
  2. [SOLVED] Dynamic Print Area Macro With Multiple Columns Of Varying Row Data
    By Gtrtim112 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-16-2019, 02:16 AM
  3. Replies: 6
    Last Post: 05-22-2018, 11:25 AM
  4. Macro to set dynamic print area
    By jb12849 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-19-2017, 07:38 AM
  5. VBA Excel dynamic print area
    By bcc6944 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2017, 05:10 PM
  6. [SOLVED] Macro to set dynamic print area
    By JEAN1972 in forum Excel General
    Replies: 4
    Last Post: 11-17-2015, 02:03 PM
  7. Automatically set Dynamic Print Area through Macro/VBA
    By stratloveslenny in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2014, 02:20 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