Selecting Print Areas
Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Selecting Print Areas

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

    Default

     
    Example - I have three named ranges:
    Yellow: A1:D8
    Green: All:D18
    Blue: A21:D28

    There is data in first cell of each range:
    A1 = 1234
    A2 = 0
    A21 = 1234

    These values may vary but what I want to do is to have a macro that will select ONLY the ranges whose values in the first cell is greater than 0.

    Any help would be greatly appreciated.

  2. #2
    Board Regular eliW's Avatar
    Join Date
    Mar 2002
    Posts
    1,919
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-04 20:46, HSA wrote:
    Example - I have three named ranges:
    Yellow: A1:D8
    Green: All:D18
    Blue: A21:D28

    There is data in first cell of each range:
    A1 = 1234
    A2 = 0
    A21 = 1234

    These values may vary but what I want to do is to have a macro that will select ONLY the ranges whose values in the first cell is greater than 0.

    Any help would be greatly appreciated.
    You need basicly this kind of macro to go over all your ranges:

    Sub PrintRange()
    Application.Goto Reference:="Yellow"
    If ActiveCell.Value > 0 Then
    Selection.PrintOut Copies:=1, Collate:=True
    End If
    End Sub

    Hope this helps,
    Eli

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This is of some help but I dont actually want to print it straight away. I just want to set the print area for those sections that do not have a nil value, ie in this example, the yellow and blue areas, but not the green.

    Thank you in anticipation

    Liz

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    use eliW's solution, but instead of the print instruction:

    Selection.PrintOut Copies:=1, Collate:=True

    use this:

    ActiveSheet.PageSetup.PrintArea = "Yellow"
    or
    ActiveSheet.PageSetup.PrintArea = "Yellow, Blue"

    whichever is the case depending on your test

    [ This Message was edited by: robfo0 on 2002-04-05 01:28 ]

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