Printing a selected worksheet

  • Thread starter Thread starter caldog
  • Start date Start date
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.
 
prtFile = InputBox("Enter a file name (with/without extension?)", "FILE
NAME")
Workbooks(prtFile).PrintOut
 
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...
 
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...
 
Back
Top