+ Reply to Thread
Results 1 to 4 of 4

Search input box data for a character

  1. #1
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Search input box data for a character

    I have an input box that asks the user for information. If the information is blank, it does one thing, if it has data in it, it does another. How do i search the inputted data for a specific character to make sure they are typing in the data correctly?

    Here is an example of the code:

    Please Login or Register  to view this content.
    How would i set it up to search for a character within that code. Something like:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search input box data for a character

    You can actually control more carefully what the user is allowed to enter by using the Application.InputBox method. This lets you determine the type of entry allowed.

    Type:=0 A formula
    Type:=1 A number
    Type:=2 Text (a string)
    Type:=4 A logical value (True or False)
    Type:=8 A cell reference, as a Range object
    Type:=16 An error value, such as #N/A
    Type:=64 An array of values

    Please Login or Register  to view this content.


    When the input is a string, you can test for specific character(s) using the Instr() method.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-22-2009
    Location
    Cornwall, England
    MS-Off Ver
    Excel 2010 (Work) O365Home (Home)
    Posts
    94

    Re: Search input box data for a character

    try using

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Search input box data for a character

    Both good answers. I will check into them and find out which one works better for my situation. Thanks to both of you.

+ 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