Printing a selected worksheet

C

caldog

I have multiple worksheets to select from, but the user will only need to
print one of those sheets. How can I in code through an input box function
ask the user to input the sheet name that is needed to be printed?

I have just checked for the last hour hunting for an answer, so sorry if
this question has been asked before.
 
J

JLGWhiz

prtFile = InputBox("Enter a file name (with/without extension?)", "FILE
NAME")
Workbooks(prtFile).PrintOut
 
J

Jacob Skaria

Try

Sub Macro()
Dim strSheet As String
strSheet = InputBox("Enter sheet name to be printed")
ActiveWorkbook.Sheets(strSheet).PrintOut Copies:=1, Collate:=True
End Sub


Would suggest to have a userform with a combo box listing the sheet names...
 
C

caldog

Thanks folks that worked just great

Jacob Skaria said:
Try

Sub Macro()
Dim strSheet As String
strSheet = InputBox("Enter sheet name to be printed")
ActiveWorkbook.Sheets(strSheet).PrintOut Copies:=1, Collate:=True
End Sub


Would suggest to have a userform with a combo box listing the sheet names...
 

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

Top