Macro to print selection

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

Guest

I am trying to creat a macro to print only a selection of a spreadsheet that
has data, however, everytime I create it all goes well. Then I run it and it
prints the entire spreadsheet (4 pages). Can anyone help me? Thanks
 
Range("B6:B7").Select
Range(Selection, Selection.End(xlDown)).Select
Range("B6:H13").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("B6").Select
 
Code:
selection.Printout

Manual:
or under the file menu, set the printarea

or when you go to print, choose selection in the dialog
 
This is my code. I have selection.printout and i have tried clearing and
creating a print area - but that didn't work either.

Range("B6:B7").Select
Range(Selection, Selection.End(xlDown)).Select
Range("B6:H13").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("B6").Select
 
Both setting a printarea and selection.printout work. So your statements
make no sense. The only problem I could see is if you have merged cells and
when you select you are actually selecting more than you think.
 
I don't see your problem but I am a little confused as to which range you
want to print since you select 3 different ranges in your macro. Ultimatley
you will be printing B6 through H13 since that is your last selection prior
to the selection print...

The entire thing could be done with just this in that case...
Range("B6:H13").PrintOut

I am guessing that is not what you intend to print however? Describe what
you would like to print and we can give you a hand...
 
I don't understand it either. Like I said, when I create it all is fine and
it prints only the selection. but when I run it - it prints all 4 pages.
I'm stumped....
 

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