+ Reply to Thread
Results 1 to 3 of 3

Type Mismatch error on InputBox

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Washington, US
    MS-Off Ver
    Excel 2003
    Posts
    73

    Type Mismatch error on InputBox

    I am trying to only have the option 1, 2, or 3 be entered. I have that part down, but if someone clicks cancel or just closes the input box i get the type mismatch I believe because no integer was found....is there a way around this?

    thanks

    here is the code I am using

    HTML Code: 
    Dim intResponse As Integer
        
        intResponse = InputBox("Choose One" & Chr(10) & Chr(10) & "1 - Lease Lock" & Chr(10) & "2 - Upgrade" & Chr(10) & "3 - Lease Lock & Upgrade", "Contract(s) sent out")
    
    If inResponse <> 1 Or strResponse <> 2 Or strResponse <> 3 Then
    
            MsgBox "Must choose (1,2,3)"
            Exit Sub
    
        End If

    thanks,

    JJ
    Last edited by h_aesa1; 10-17-2009 at 09:24 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    21,528

    Re: Type Mismatch error on InputBox

    First, try using Application.InputBox as this gives you a little more control in terms of validation...

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 10-17-2009 at 09:23 AM.

  3. #3
    Registered User
    Join Date
    02-09-2009
    Location
    Washington, US
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Type Mismatch error on InputBox

    thank you very much...that works wonders!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1