Macro Not Working Properly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top