+ Reply to Thread
Results 1 to 2 of 2

InputBox with conditions

  1. #1
    Registered User
    Join Date
    03-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    67

    InputBox with conditions

    Hi,

    I am creating an inputbox where I can add the client number manually with 11 digits, but it is not working properly:

    1. When I click on OK without adding anything, it will shows up the MsgBox, but I want it to reload it back so I can input it. May be loop until 11 digits is entered?
    2. When I click on cancel, instead of just exiting, a MsgBox will appear by showing "Client's Number must have 11 digits!"


    What should be amended?

    Thanks

    Sub InputClient()

    Dim ClNum As Variant

    ClNum = Application.InputBox("Please input the Client Number (11 digits)", "Manual Client Input")

    If Not (ClNum) Like "###########" Then
    MsgBox "Client's Number must have 11 digits!", , ""
    If ClNum = False Then Exit Sub 'User cancelled

    Else
    wsSheet1.Range("A1").Value = ClNum
    End If

    End Sub
    ClientInput.xlsm

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: InputBox with conditions

    Hi,

    Maybe :

    Please Login or Register  to view this content.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Inputbox vs. Application.InputBox
    By miyachow in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 12:53 PM
  2. [SOLVED] If inputbox = false then repeat inputbox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2013, 01:27 PM
  3. [SOLVED] Vlookup - Country conditions (Multiple conditions)
    By dluhut in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-26-2013, 11:42 AM
  4. [SOLVED] Text results with two conditions (lookup with two conditions)
    By Davzx in forum Excel General
    Replies: 8
    Last Post: 05-25-2012, 03:08 AM
  5. InputBox-ow to have a user input text in a inputbox
    By noodle48 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2011, 08:17 AM
  6. Screen positioning inputbox that is set as Application.InputBox
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2010, 07:59 AM
  7. InputBox-Is it possible to put 2 question in one InputBox ?
    By Shark Man in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2009, 12:04 AM
  8. Inputbox button control + msgbox for empty inputbox
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-30-2009, 12:39 PM

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