+ Reply to Thread
Results 1 to 3 of 3

ActiveSheet.PageSetup.PrintArea variable ?

  1. #1
    MAS
    Guest

    ActiveSheet.PageSetup.PrintArea variable ?

    Hi,

    I have a macro that prints the content od a range of cells and i have it set
    to print D,142 to AA,142 using ActiveSheet.PageSetup.PrintArea =
    "$D$142:$AA$142"

    Every now and then the row changes (people adding/deleting rows) so I have
    created a row variable by searching for a string that only appears in the
    row I want to print as follows;

    CtoPrintRow = "CTO Requests"
    r = 1
    Do Until CtoPrintRow = (Cells(r, 1))
    r = r + 1
    Loop

    I can't get my head around how I use now use the variable to print that row,
    I have fiddled with it as follows but clearly I am missing something, but
    what ?

    ActiveSheet.PageSetup.PrintArea = "$D$r:$AA$r"




  2. #2
    Tom Ogilvy
    Guest

    Re: ActiveSheet.PageSetup.PrintArea variable ?

    ActiveSheet.PageSetup.PrintArea = "$D$" & r & ":$AA$" & r

    --
    Regards,
    Tom Ogilvy


    "MAS" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I have a macro that prints the content od a range of cells and i have it

    set
    > to print D,142 to AA,142 using ActiveSheet.PageSetup.PrintArea =
    > "$D$142:$AA$142"
    >
    > Every now and then the row changes (people adding/deleting rows) so I have
    > created a row variable by searching for a string that only appears in the
    > row I want to print as follows;
    >
    > CtoPrintRow = "CTO Requests"
    > r = 1
    > Do Until CtoPrintRow = (Cells(r, 1))
    > r = r + 1
    > Loop
    >
    > I can't get my head around how I use now use the variable to print that

    row,
    > I have fiddled with it as follows but clearly I am missing something, but
    > what ?
    >
    > ActiveSheet.PageSetup.PrintArea = "$D$r:$AA$r"
    >
    >
    >




  3. #3
    MAS
    Guest

    Re: ActiveSheet.PageSetup.PrintArea variable ?

    Thank Tom,



    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > ActiveSheet.PageSetup.PrintArea = "$D$" & r & ":$AA$" & r
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "MAS" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi,
    >>
    >> I have a macro that prints the content od a range of cells and i have it

    > set
    >> to print D,142 to AA,142 using ActiveSheet.PageSetup.PrintArea =
    >> "$D$142:$AA$142"
    >>
    >> Every now and then the row changes (people adding/deleting rows) so I
    >> have
    >> created a row variable by searching for a string that only appears in the
    >> row I want to print as follows;
    >>
    >> CtoPrintRow = "CTO Requests"
    >> r = 1
    >> Do Until CtoPrintRow = (Cells(r, 1))
    >> r = r + 1
    >> Loop
    >>
    >> I can't get my head around how I use now use the variable to print that

    > row,
    >> I have fiddled with it as follows but clearly I am missing something, but
    >> what ?
    >>
    >> ActiveSheet.PageSetup.PrintArea = "$D$r:$AA$r"
    >>
    >>
    >>

    >
    >




+ 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