+ Reply to Thread
Results 1 to 4 of 4

Macro script for setting Print Area

Hybrid View

  1. #1
    JB2010
    Guest

    Macro script for setting Print Area

    Hi

    Can someone list the full script i would need for a macro that would
    highlight all the non blank cells of a worksheet & set that as the print area.

    I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift Down
    then Control+Shift Right, but the resulting script is still specific to the
    cell references of the sheet i used to record on.

    I do not know how to program it for just all active cells regardless of what
    they are, from sheet to sheet.

    Any help gratefully recieved.


    Cheers


    jb

  2. #2
    Colin Sandall
    Guest

    Re: Macro script for setting Print Area

    JB,

    This: Selection.CurrentRegion.Select

    Will select the current region providing that there are no entire rows or
    columns blank, i.e. it will select from the cell uppermost and to the left
    and bottommost and to the right before the next blank columns and rows.

    Regards

    Colin
    "JB2010" <JB2010@discussions.microsoft.com> wrote in message
    news:2A956AAA-94E4-45D4-82DA-F053923B6BE7@microsoft.com...
    > Hi
    >
    > Can someone list the full script i would need for a macro that would
    > highlight all the non blank cells of a worksheet & set that as the print
    > area.
    >
    > I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift
    > Down
    > then Control+Shift Right, but the resulting script is still specific to
    > the
    > cell references of the sheet i used to record on.
    >
    > I do not know how to program it for just all active cells regardless of
    > what
    > they are, from sheet to sheet.
    >
    > Any help gratefully recieved.
    >
    >
    > Cheers
    >
    >
    > jb




  3. #3
    Colin Sandall
    Guest

    Re: Macro script for setting Print Area

    I forgot to add:

    Sheets ("xxx").Select
    Range("A1").Select (Assuming data starts here)
    Selection.CurrentRegion.Select

    Colin
    "JB2010" <JB2010@discussions.microsoft.com> wrote in message
    news:2A956AAA-94E4-45D4-82DA-F053923B6BE7@microsoft.com...
    > Hi
    >
    > Can someone list the full script i would need for a macro that would
    > highlight all the non blank cells of a worksheet & set that as the print
    > area.
    >
    > I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift
    > Down
    > then Control+Shift Right, but the resulting script is still specific to
    > the
    > cell references of the sheet i used to record on.
    >
    > I do not know how to program it for just all active cells regardless of
    > what
    > they are, from sheet to sheet.
    >
    > Any help gratefully recieved.
    >
    >
    > Cheers
    >
    >
    > jb




  4. #4
    Dave Peterson
    Guest

    Re: Macro script for setting Print Area

    Maybe:

    With ActiveSheet
    .PageSetup.PrintArea = .Range("A1").CurrentRegion.Address
    end with

    JB2010 wrote:
    >
    > Hi
    >
    > Can someone list the full script i would need for a macro that would
    > highlight all the non blank cells of a worksheet & set that as the print area.
    >
    > I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift Down
    > then Control+Shift Right, but the resulting script is still specific to the
    > cell references of the sheet i used to record on.
    >
    > I do not know how to program it for just all active cells regardless of what
    > they are, from sheet to sheet.
    >
    > Any help gratefully recieved.
    >
    > Cheers
    >
    > jb


    --

    Dave Peterson

+ 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