+ Reply to Thread
Results 1 to 6 of 6

Setting the print area

  1. #1
    Patch61
    Guest

    Setting the print area

    Once again I am frustrated by the almost useless Excel VBA programming help.
    Why does such a large commercial program have such crappy help? I had better
    programming help back in the days of programming on the Atari ST!

    I need a way to set the print area where I know the starting and ending
    columns and rows. The only example the help gives is for the 'CurrentRegion.'
    There is no current region set, nor do I want to force the user to make one.

    I would prefer being able to use column and row numbers as opposed to the
    A1:G20 method. One would think this would be a simple thing, but here I am.

    Any help will be appreciated.

    -Steve






  2. #2
    papou
    Guest

    Re: Setting the print area

    Hello
    Dim lastcol&, lastrow&
    With Worksheets("Feuil1")
    lastcol = .Range("IV1").End(xlToLeft).Column
    lastrow = .Range("A65536").End(xlUp).Row
    ..PageSetup.PrintArea = Range("A1", Cells(lastrow, lastcol)).Address
    End With

    HTH
    Cordially
    Pascal

    "Patch61" <Patch61@discussions.microsoft.com> a écrit dans le message de
    news: F8DB2462-0D62-4054-9111-8C17513182AD@microsoft.com...
    > Once again I am frustrated by the almost useless Excel VBA programming
    > help.
    > Why does such a large commercial program have such crappy help? I had
    > better
    > programming help back in the days of programming on the Atari ST!
    >
    > I need a way to set the print area where I know the starting and ending
    > columns and rows. The only example the help gives is for the
    > 'CurrentRegion.'
    > There is no current region set, nor do I want to force the user to make
    > one.
    >
    > I would prefer being able to use column and row numbers as opposed to the
    > A1:G20 method. One would think this would be a simple thing, but here I
    > am.
    >
    > Any help will be appreciated.
    >
    > -Steve
    >
    >
    >
    >
    >




  3. #3
    Tom Ogilvy
    Guest

    RE: Setting the print area


    startcol = 1
    startrow = 3
    endcol = 9
    endrow = 25
    With Activesheet
    .PageSetup.PrintArea = .Range(.Cells(startRow,StartCol), _
    .Cells(EndRow,EndCol)).Address(1,1,xlA1,True)
    End With

    --
    Regards,
    Tom Ogilvy

    "Patch61" wrote:

    > Once again I am frustrated by the almost useless Excel VBA programming help.
    > Why does such a large commercial program have such crappy help? I had better
    > programming help back in the days of programming on the Atari ST!
    >
    > I need a way to set the print area where I know the starting and ending
    > columns and rows. The only example the help gives is for the 'CurrentRegion.'
    > There is no current region set, nor do I want to force the user to make one.
    >
    > I would prefer being able to use column and row numbers as opposed to the
    > A1:G20 method. One would think this would be a simple thing, but here I am.
    >
    > Any help will be appreciated.
    >
    > -Steve
    >
    >
    >
    >
    >


  4. #4
    Martin
    Guest

    RE: Setting the print area

    If you use the recorder you can get the essential code needed (far easier
    than trying to find it in Help!), e.g.
    ActiveSheet.PageSetup.PrintArea = "A1:J10"

    However, as you say, R1C1 method can be easier so it needs amendment:
    Dim myRange As String
    myRange = "R1C1:R10C10"
    myRange = Application.ConvertFormula(myRange, xlR1C1, xlA1)
    ActiveSheet.PageSetup.PrintArea = myRange

    or (combining it all up):
    ActiveSheet.PageSetup.PrintArea =
    Application.ConvertFormula("R1C1:R10C10", xlR1C1, xlA1)



    "Patch61" wrote:

    > Once again I am frustrated by the almost useless Excel VBA programming help.
    > Why does such a large commercial program have such crappy help? I had better
    > programming help back in the days of programming on the Atari ST!
    >
    > I need a way to set the print area where I know the starting and ending
    > columns and rows. The only example the help gives is for the 'CurrentRegion.'
    > There is no current region set, nor do I want to force the user to make one.
    >
    > I would prefer being able to use column and row numbers as opposed to the
    > A1:G20 method. One would think this would be a simple thing, but here I am.
    >
    > Any help will be appreciated.
    >
    > -Steve
    >
    >
    >
    >
    >


  5. #5
    Patch61
    Guest

    RE: Setting the print area

    Thanks, guys. This is exactly what I needed.

    -Steve

    "Tom Ogilvy" wrote:

    >
    > startcol = 1
    > startrow = 3
    > endcol = 9
    > endrow = 25
    > With Activesheet
    > .PageSetup.PrintArea = .Range(.Cells(startRow,StartCol), _
    > .Cells(EndRow,EndCol)).Address(1,1,xlA1,True)
    > End With
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Patch61" wrote:
    >
    > > Once again I am frustrated by the almost useless Excel VBA programming help.
    > > Why does such a large commercial program have such crappy help? I had better
    > > programming help back in the days of programming on the Atari ST!
    > >
    > > I need a way to set the print area where I know the starting and ending
    > > columns and rows. The only example the help gives is for the 'CurrentRegion.'
    > > There is no current region set, nor do I want to force the user to make one.
    > >
    > > I would prefer being able to use column and row numbers as opposed to the
    > > A1:G20 method. One would think this would be a simple thing, but here I am.
    > >
    > > Any help will be appreciated.
    > >
    > > -Steve
    > >
    > >
    > >
    > >
    > >


  6. #6
    Don Guillett
    Guest

    Re: Setting the print area

    feel better now?

    Sub setprintarea()
    ActiveSheet.PageSetup.PrintArea = _
    Range(Cells(4, 4), Cells(12, 8)).Address
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "Patch61" <Patch61@discussions.microsoft.com> wrote in message
    news:F8DB2462-0D62-4054-9111-8C17513182AD@microsoft.com...
    > Once again I am frustrated by the almost useless Excel VBA programming
    > help.
    > Why does such a large commercial program have such crappy help? I had
    > better
    > programming help back in the days of programming on the Atari ST!
    >
    > I need a way to set the print area where I know the starting and ending
    > columns and rows. The only example the help gives is for the
    > 'CurrentRegion.'
    > There is no current region set, nor do I want to force the user to make
    > one.
    >
    > I would prefer being able to use column and row numbers as opposed to the
    > A1:G20 method. One would think this would be a simple thing, but here I
    > am.
    >
    > Any help will be appreciated.
    >
    > -Steve
    >
    >
    >
    >
    >




+ 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