Help on following code please?

G

Greg

MyInput = InputBox("ENTER THE PLAYERS REGISTRATION #")

Hi all I am wondering how to change the code on this input box it does what
I want but if the person hits the cancel button or the x button i need it to
go to a userform called "main"
How do I do this?

here is the full code

Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:2")
Dim MyInput
Dim A
Sheet2.Activate

On Error Resume Next

MyInput = InputBox("ENTER THE PLAYERS REGISTRATION #")
A = Application.Match(CLng(MyInput), Range("A:A"), 0)
Label1.Caption = Application.Index(Range("B:B"), A)
INDSCORE.Caption = " THE PLAYER YOU HAVE SELECTED IS " &
Label1.Caption & " REGISTRATION NUMBER " & MyInput & ", IS THIS THE CORRECT
PLAYER?"
If Not IsError(A) Then
Else
MsgBox "PLEASE CHECK THE REGISTRATION NUMBER"
Unload Me
INDSCORE.Show

End If
On Error GoTo 0

End Sub

Thanks Greg
 
C

Chip Pearson

Try something like

Dim S As String
S = InputBox("Enter something")
If StrPtr(S) = 0 Then
main.Show
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Greg

Thanks Chip that I never thought of.

Greg
Chip Pearson said:
Try something like

Dim S As String
S = InputBox("Enter something")
If StrPtr(S) = 0 Then
main.Show
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top