VBA Print code?????

  • Thread starter Thread starter Chris Watson
  • Start date Start date
C

Chris Watson

Can anybody give me the VBA code for a command button that will prin
the active worksheet and also give the user the option to select ho
many
 
very simplistic

Dim i As Integer

i = InputBox("How many copies")
ActiveSheet.PrintOut copies:=i
 
Create the button and associate it with this code

Sub Print_Sheet()

Dim Message, Title, Default, MyValue
Message = "Enter Number Of Copies To Print" ' Set prompt.
Title = "Print" ' Set title.
Default = "1" ' Set default.
MyValue = InputBox(Message, Title, Default)

If Not IsNumeric(MyValue) Then
MsgBox "Please enter a vilid number", vbInformation
GoTo NoPrinting
End If

ActiveWindow.SelectedSheets.PrintOut Copies:=MyValue

NoPrinting:

End Sub
 

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