+ Reply to Thread
Results 1 to 3 of 3

Input box

  1. #1
    TimMalone
    Guest

    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. #2
    Alok
    Guest

    RE: 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. #3
    TimMalone
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1