how to select print area within the macro if report is going
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: how to select print area within the macro if report is going

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I want to know how to select print area within the macro if report is going to be of varied length within a macro if i do ctrl+shift+end in the macro it sets it to the length of current report but when i run a longer report the print area is not proper

    any idea?

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If your "current" Print Area is something like

    A1:H46

    put this as your NEW Print Area.

    A:H

    It'll adjust itself automatically.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    357
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    If your print range is in Columns A:H and you don't know how long it will be, this should work for you.

    Dim ReportRange as Range

    'Sets Ranges from A1 to
    'the last cell with data in column H
    'which is searched for by starting with cell H65536 and
    'going up to the last cels with data in column H
    Set ReportRange = Range("A1",Range("H65536").End(xlup).Address)


    ReportRange.Select

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com