#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"