+ Reply to Thread
Results 1 to 5 of 5

Macro Not Working Properly

  1. #1
    PA
    Guest

    Macro Not Working Properly

    I have the following macro which I recorded (I am not knowledgeable in VBA).

    Sub Print1()

    Sheets("Buyer List").Select
    Range("A1:G15").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    Range("A1").Select
    Sheets("Main").Select

    End Sub

    From the worksheet named Main, it goes to the Buyer list worksheet, selects
    the range A1:G15 and prints. Then goes back to Main.
    The problem is that I get a far larger range printed and for the life of me,
    I can not figure out why. It actually prints A1:L225
    Any guidance will be appreciated.
    Thank you.
    Paul

  2. #2
    ben
    Guest

    RE: Macro Not Working Properly

    Sub Print1()

    Sheets("Buyer List").Select
    Range("A1:G15").Select
    Activesheet.pagesetup.printarea =PageSetup.PrintArea= "$A$1:$G$15"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    Range("A1").Select
    Sheets("Main").Select

    End Sub
    --
    When you lose your mind, you free your life.


    "PA" wrote:

    > I have the following macro which I recorded (I am not knowledgeable in VBA).
    >
    > Sub Print1()
    >
    > Sheets("Buyer List").Select
    > Range("A1:G15").Select
    > ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    > Range("A1").Select
    > Sheets("Main").Select
    >
    > End Sub
    >
    > From the worksheet named Main, it goes to the Buyer list worksheet, selects
    > the range A1:G15 and prints. Then goes back to Main.
    > The problem is that I get a far larger range printed and for the life of me,
    > I can not figure out why. It actually prints A1:L225
    > Any guidance will be appreciated.
    > Thank you.
    > Paul


  3. #3
    PA
    Guest

    RE: Macro Not Working Properly (Figured it out)

    I neglected to use Print Selection.

    "PA" wrote:

    > I have the following macro which I recorded (I am not knowledgeable in VBA).
    >
    > Sub Print1()
    >
    > Sheets("Buyer List").Select
    > Range("A1:G15").Select
    > ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    > Range("A1").Select
    > Sheets("Main").Select
    >
    > End Sub
    >
    > From the worksheet named Main, it goes to the Buyer list worksheet, selects
    > the range A1:G15 and prints. Then goes back to Main.
    > The problem is that I get a far larger range printed and for the life of me,
    > I can not figure out why. It actually prints A1:L225
    > Any guidance will be appreciated.
    > Thank you.
    > Paul


  4. #4
    JMB
    Guest

    RE: Macro Not Working Properly

    Sheets("Buyer List").Range("A1:G15").Printout

    "PA" wrote:

    > I have the following macro which I recorded (I am not knowledgeable in VBA).
    >
    > Sub Print1()
    >
    > Sheets("Buyer List").Select
    > Range("A1:G15").Select
    > ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    > Range("A1").Select
    > Sheets("Main").Select
    >
    > End Sub
    >
    > From the worksheet named Main, it goes to the Buyer list worksheet, selects
    > the range A1:G15 and prints. Then goes back to Main.
    > The problem is that I get a far larger range printed and for the life of me,
    > I can not figure out why. It actually prints A1:L225
    > Any guidance will be appreciated.
    > Thank you.
    > Paul


  5. #5
    JMB
    Guest

    RE: Macro Not Working Properly

    Posted before finishing my thoughts. You don't need to select the range (or
    the worksheet, for that matter) to print it. Your macro can be replaced with

    Sheets("Buyer List").Range("A1:G15").PrintOut


    "PA" wrote:

    > I have the following macro which I recorded (I am not knowledgeable in VBA).
    >
    > Sub Print1()
    >
    > Sheets("Buyer List").Select
    > Range("A1:G15").Select
    > ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    > Range("A1").Select
    > Sheets("Main").Select
    >
    > End Sub
    >
    > From the worksheet named Main, it goes to the Buyer list worksheet, selects
    > the range A1:G15 and prints. Then goes back to Main.
    > The problem is that I get a far larger range printed and for the life of me,
    > I can not figure out why. It actually prints A1:L225
    > Any guidance will be appreciated.
    > Thank you.
    > Paul


+ 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