+ Reply to Thread
Results 1 to 7 of 7

Set Print Area programatically

  1. #1
    Mervyn Thomas
    Guest

    Set Print Area programatically

    Can anyone help me get the syntax right. I have tried variations on the
    theme:

    Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    ActiveSheet.PageSetup.PrintArea = Selection

    but cannot get anything past the debugger!

    Thanks
    mervyn



  2. #2
    Ron de Bruin
    Guest

    Re: Set Print Area programatically

    Hi Mervyn

    Use this
    ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), Cells(NoOfRows, 29)).Address

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Mervyn Thomas" <[email protected]> wrote in message news:pZZ%[email protected]...
    > Can anyone help me get the syntax right. I have tried variations on the theme:
    >
    > Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    > ActiveSheet.PageSetup.PrintArea = Selection
    >
    > but cannot get anything past the debugger!
    >
    > Thanks
    > mervyn
    >




  3. #3
    K Dales
    Guest

    RE: Set Print Area programatically

    Syntax is OK; are you sure NoOfRows gives the correct result? If it is 0,
    this would give "Application defined or object defined error."

    "Mervyn Thomas" wrote:

    > Can anyone help me get the syntax right. I have tried variations on the
    > theme:
    >
    > Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    > ActiveSheet.PageSetup.PrintArea = Selection
    >
    > but cannot get anything past the debugger!
    >
    > Thanks
    > mervyn
    >
    >
    >


  4. #4
    Mervyn Thomas
    Guest

    Re: Set Print Area programatically

    Thanks - that works!
    "Ron de Bruin" <[email protected]> wrote in message
    news:Ow%[email protected]...
    > Hi Mervyn
    >
    > Use this
    > ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), Cells(NoOfRows,
    > 29)).Address
    >
    > --
    > Regards Ron de Bruin
    > http://www.rondebruin.nl
    >
    >
    >
    > "Mervyn Thomas" <[email protected]> wrote in message
    > news:pZZ%[email protected]...
    >> Can anyone help me get the syntax right. I have tried variations on the
    >> theme:
    >>
    >> Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    >> ActiveSheet.PageSetup.PrintArea = Selection
    >>
    >> but cannot get anything past the debugger!
    >>
    >> Thanks
    >> mervyn
    >>

    >
    >




  5. #5
    Mervyn Thomas
    Guest

    Re: Set Print Area programatically

    I thought so too! but the other reply does work
    Mervyn
    "K Dales" <[email protected]> wrote in message
    news:[email protected]...
    > Syntax is OK; are you sure NoOfRows gives the correct result? If it is 0,
    > this would give "Application defined or object defined error."
    >
    > "Mervyn Thomas" wrote:
    >
    >> Can anyone help me get the syntax right. I have tried variations on the
    >> theme:
    >>
    >> Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    >> ActiveSheet.PageSetup.PrintArea = Selection
    >>
    >> but cannot get anything past the debugger!
    >>
    >> Thanks
    >> mervyn
    >>
    >>
    >>




  6. #6
    Ron de Bruin
    Guest

    Re: Set Print Area programatically

    It miss
    ..Address after selection

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Mervyn Thomas" <[email protected]> wrote in message news:Ll_%[email protected]...
    >I thought so too! but the other reply does work
    > Mervyn
    > "K Dales" <[email protected]> wrote in message news:[email protected]...
    >> Syntax is OK; are you sure NoOfRows gives the correct result? If it is 0,
    >> this would give "Application defined or object defined error."
    >>
    >> "Mervyn Thomas" wrote:
    >>
    >>> Can anyone help me get the syntax right. I have tried variations on the
    >>> theme:
    >>>
    >>> Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    >>> ActiveSheet.PageSetup.PrintArea = Selection
    >>>
    >>> but cannot get anything past the debugger!
    >>>
    >>> Thanks
    >>> mervyn
    >>>
    >>>
    >>>

    >
    >




  7. #7
    Tom Ogilvy
    Guest

    Re: Set Print Area programatically

    PrintArea requires a string argument. It resists range objects unless they
    contain a string address

    maybe selection.Address

    --
    Regards,
    Tom Ogilvy



    "K Dales" <[email protected]> wrote in message
    news:[email protected]...
    > Syntax is OK; are you sure NoOfRows gives the correct result? If it is 0,
    > this would give "Application defined or object defined error."
    >
    > "Mervyn Thomas" wrote:
    >
    > > Can anyone help me get the syntax right. I have tried variations on the
    > > theme:
    > >
    > > Range(Cells(1, 1), Cells(NoOfRows, 29)).Select
    > > ActiveSheet.PageSetup.PrintArea = Selection
    > >
    > > but cannot get anything past the debugger!
    > >
    > > Thanks
    > > mervyn
    > >
    > >
    > >




+ 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