![]() |
Input box
Would someone be so kind as to help me with the following question?
I would like to include a macro in a workbook that, upon running, displays an input box for the user to input a worksheet name (e.g. Sheet1) which in turn would be selected, print range set and ultimately printed. Sincere thanks to any and all who are so gracious to offer their help with these matters. Regards, Tim Malone |
Input box
Here is something you can use.
Sub PrintWS() Dim ws As Worksheet Dim sName$ On Error GoTo ErrorInPrintWS sName = InputBox("Enter worksheet name", "Print") If sName < "" Then Set ws = Worksheets(sName) ws.PrintOut End If Exit Sub ErrorInPrintWS: Exit Sub End Sub "TimMalone" wrote: Would someone be so kind as to help me with the following question? I would like to include a macro in a workbook that, upon running, displays an input box for the user to input a worksheet name (e.g. Sheet1) which in turn would be selected, print range set and ultimately printed. Sincere thanks to any and all who are so gracious to offer their help with these matters. Regards, Tim Malone |
Input box
Thanks! It works great. I can't believe how quickly you were able to do
this...I have much to learn. "Alok" wrote: Here is something you can use. Sub PrintWS() Dim ws As Worksheet Dim sName$ On Error GoTo ErrorInPrintWS sName = InputBox("Enter worksheet name", "Print") If sName < "" Then Set ws = Worksheets(sName) ws.PrintOut End If Exit Sub ErrorInPrintWS: Exit Sub End Sub "TimMalone" wrote: Would someone be so kind as to help me with the following question? I would like to include a macro in a workbook that, upon running, displays an input box for the user to input a worksheet name (e.g. Sheet1) which in turn would be selected, print range set and ultimately printed. Sincere thanks to any and all who are so gracious to offer their help with these matters. Regards, Tim Malone |
All times are GMT +1. The time now is 07:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com