Input Boxes - anyone good at these?

Audiojoe

Active Member
Joined
Feb 20, 2002
Messages
285
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?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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
 
Upvote 0
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- *snigger*, beaten to it by Derek again, fingers must be getting old :)
This message was edited by Mudface on 2002-02-22 05:20
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,222
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top