Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm running the macro below and everything seemed OK.....I enter th wrong numberic code I get a "Number is incorrect" message and it stops I enter the right numeric code and it and goes on and runs anothe macro. Problem is, if I the user enters an incorrect alph code (e.g. ABCD) i bombs out and shows the error as.... "Run-Time error 13 - Typ Mismatch". Could anyone please tell me how I can avoid this from happening, an instead get it to produce the same "Number is incorrect" message? When the macro interupts it highlights the line 'If CLng(myNum) = ActiveCell.Value Then'. Many thanks!! Chris --------------------------------------------------------------------------- Sub CommandButton1_Click() myNum = InputBox("Please enter your 8 digit validation code. :", "Ente Code") If myNum = "" Then Exit Sub End If Sheets("Sheet1").Select Range("a3").Select If CLng(myNum) = ActiveCell.Value Then Application.OnTime Now, "RunAnotherMacro" Else MsgBox "Number is incorrect" End If Sheets("Sheet1").Select Range("A1").Value = myNum End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I can't input anything I type on Excel. What can I do? Nothing p. | Excel Worksheet Functions | |||
error 13 type mismatch input box | Excel Discussion (Misc queries) | |||
Exit Code Upon Cancel On Type 8 Input Box | Excel Discussion (Misc queries) | |||
How to modify the code for different type of input? | Excel Worksheet Functions | |||
How to modify the code for different type of input? | Excel Discussion (Misc queries) |