Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
run code on opening workbook and apply code to certain sheets | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming |