Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Input Boxes - anyone good at these?

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Howdy,

    What I need is an input box to flash up when a workbook is opened that requests the user's name. When they put it in, it takes them to their individual sheet within the workbook if you know what I mean

    For instance, the sheet tabs at the bottom would be called Tom, **** and Harry. When they opened the workbook an input box asked them their name. When they put their name it would take them to their sheet

    Can anyone help me?

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,584
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Audiojoe
    You can use the following code as a workbook event macro.
    Copy the code
    Alt+F11 to access VB Editor
    In the vbProject window click on This Workbook
    From the left dropdown box above the large white area select Workbook and from the right dropdown box select Open
    Paste the following code in the white space
    Use Alt+F11 to return to worksheet


    Private Sub Workbook_Open()

    x = Application.InputBox("Please enter your name: Tom / **** / Harry", "WELCOME")
    Sheets(x).Select
    End Sub

    Regards
    Derek

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following code: -

    Private Sub Workbook_Open()

    Call GetUser

    End Sub

    Put the GetUser sub in a normal module: -

    Public Sub GetUser()

    user = InputBox("Please enter your user name")
    On Error GoTo errorhandler
    Worksheets(user).Activate

    Exit Sub

    errorhandler:
    response = MsgBox("Your entry is not recognised. Do you wish to re-enter?", vbYesNo)
    If response = vbYes Then
    Call GetUser
    Else:
    Workbooks(1).Close
    End If

    End Sub


    Edit- *s*******, beaten to it by Derek again, fingers must be getting old

    [ This Message was edited by: Mudface on 2002-02-22 05:20 ]

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks guys, also, do you know how to fix it so that a workbook always opens on the same page, for instance the name of the sheet I need it to open to all the itme is called COVER

    Sorry to keep buggin you all

  5. #5
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Slide this in workbook_open() vba

    worksheets("cover").select

    Cheers,

    Nate

  6. #6
    New Member
    Join Date
    Feb 2002
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Nice work, folks...can anyone suggest code for a button-based approach to this, i.e., up comes an input box with buttons represent page selections?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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