Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"