ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help on following code please? (https://www.excelbanter.com/excel-programming/362960-help-following-code-please.html)

Greg[_27_]

Help on following code please?
 
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



Chip Pearson

Help on following code please?
 
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


"Greg" wrote in message
...
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




Greg[_27_]

Help on following code please?
 
Thanks Chip that I never thought of.

Greg
"Chip Pearson" wrote in message
...
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


"Greg" wrote in message
...
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







All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com