![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 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, Dick 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 |
|
Board Regular
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,567
|
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 / Dick / Harry", "WELCOME") Sheets(x).Select End Sub Regards Derek |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
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 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
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 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Slide this in workbook_open() vba
worksheets("cover").select Cheers, Nate |
|
|
|
|
|
#6 |
|
New Member
Join Date: Feb 2002
Posts: 31
|
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?
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|