button to print

  • Thread starter Thread starter rob
  • Start date Start date
R

rob

Hi I have got a big worksheet with lots of information in
it. I need to have a button to be able to click and
print a sheet out automatically - Is this possible?

If you do know a way to do this please let me know.

Thank you

Rob
 
rob

It is possible, but only you know what you want printed and what your print
setup(printarea, margins, headers/footers etc.) will be.

Suggest you Turn on the macro recorder while you do all that then print the
sheet.

You will get something like this...........

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 1/13/2005 by Gord Dibben


ActiveSheet.PageSetup.PrintArea = "$A$1:$N$32"
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$A$1:$N$32"
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "Page &P of &N"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.551181102362205)
.RightMargin = Application.InchesToPoints(0.275590551181102)
.TopMargin = Application.InchesToPoints(0.748031496062992)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

Enable the Forms Toolbar and draw a button on the sheet. Assign the macro to
the button.


Gord Dibben Excel MVP
 
If your toolbar does NOT have a printer icon on it already then
right click the toolbar>customize>commands>file>print icon(drag to
toolbar)OK
 
Back
Top