Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On my spreadsheet I have a user form that loads up where their are two text
boxes on for the First Name and another for the Last Name. With the help of Tom I have created a macro that takes the input from the text boxes and takes the user to their corresponding range. The problem I am having is if an incorrect user name is entered such as "Bob Dole" I get a run time error instead of the message box that is entered in my code. Below is the code I have. Can someone tell me what is wrong with my IF rng=nothing I keep getting an object not defined error message on it when the wrong name is inputed. Private Sub Login_click() With UserInterface On Error Resume Next Set rng = Worksheets("Employee Tracker").Range( _ .TextboxFirst.Text & "_" & .TextBoxLast.Text) On Error GoTo 0 If rng Is Nothing Then MsgBox "Bad name, quitting" Unload UserInterface ThisWorkbook.Close Savechanges:=False End If End With Worksheets("Employee Tracker").Unprotect Password:="testpass" Range("A5:N25").Select Selection.Locked = True Application.Goto rng, True Unload UserInterface Call Macro3 End Sub Thanks in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help selecting a range in vba from userform inputs | Excel Programming | |||
Automated userform inputs to the spreadsheet | Excel Programming | |||
Automated userform inputs to the spreadsheet | Excel Programming | |||
userform inputs | Excel Programming | |||
userform inputs | Excel Programming |