+ Reply to Thread
Results 1 to 21 of 21

Restricting Entry In Text Box

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Restricting Entry In Text Box

    Hello everybody
    How can I restrict entry in textbox to accept only English letters not Arabic letters not numbers?
    And a nother textbox that only accepts Arabic letters not English letters not numbers?
    And a nother textbox that only accepts just numbers?
    Thanks advanced

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Restricting Entry In Text Box

    My PC doesn't have Arabic installed so I can't give much input on that. But to validate English letters and numbers, you can probably use ASC function to get the code that correspond to the letter and validate against the code. Take a look of the example I attached.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Thanks for this good attachment.
    I forgot to say text boxes on a userform ...

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Restricting Entry In Text Box

    Even if it is on a UserForm, the concept and the coding should be identical.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    I want to restrict input .. when typing for example numbers in a textbox which is restriected to English letters, then users can not input numbers nor Arabic letters just English letters

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    I have no Arabic fonts installed so can not test.
    UDF
    Please Login or Register  to view this content.
    We have IsNumeric built-in function.
    Use like
    Please Login or Register  to view this content.
    Replace IsAlphabet with IsNumeric for Numbers, IsArabic for Arabic character.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Great Mr. jindon
    You have solved most of the problem.. Thank you very much
    Just Arabic doesn't work
    When applying Arabic part ,the textbox doesn't accept any entry

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    I wonder if the Right$ function should be replaced with Left$ function for Arabic?

    Logically the code should detect Arabic character....

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    Can you also change the pattern to
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Perfect solution. It works very well now with Arabic
    Thank you very much Mr. jindon for your help

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  12. #12
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    After applying the last change everything is ok if I started Arabic letters but After typing some Arabic letters I could type English letters and numbers
    This problem for txtArabic only
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    Can you try change to
    Please Login or Register  to view this content.
    Last edited by jindon; 12-22-2014 at 03:23 AM.

  14. #14
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    It doesn't work .. the same problem
    I tried this :: but failed
    Please Login or Register  to view this content.
    Everything is ok .. I tried and no numbers can be input nor English letters .. But I can't take spaces between words
    The problem now with spaces

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    Then try change Change event code to and you can delete IsArabic Function.
    Please Login or Register  to view this content.

  16. #16
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Great fantastic ... But now I have a problem with spaces .. If I want to type two or more words in any textboxes of the three I can't take spaces

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    Then change Pattern to
    Please Login or Register  to view this content.

  18. #18
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Great great Mr. jindon the last change was wonderful
    It prevents any input except Arabic .. That's awesome

    What about txtEnglish and txtNumers.. How can I take spaces especially for txtEnglish ...?

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    Change to
    IsAlphabet;
    Please Login or Register  to view this content.
    IsNumeric; if you need.
    Please Login or Register  to view this content.

  20. #20
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Restricting Entry In Text Box

    Great great great .. Now txtArabic and txtEnglish are perfect
    Just numbers have to be adjusted again

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Restricting Entry In Text Box

    If you also want space to be entered then
    Change TextBox1 to actual control name
    Please Login or Register  to view this content.

+ 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. Restricting entry into multiple cells
    By maryfay in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-04-2012, 07:10 AM
  2. Restricting data entry to 1 of 3 cells
    By Gunnjg in forum Excel General
    Replies: 2
    Last Post: 08-21-2008, 04:23 PM
  3. [SOLVED] Restricting entry in B1 on the basis of entry in A1
    By Stilla in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-03-2005, 05:20 PM
  4. [SOLVED] Re: Restricting entry in B1 on the basis of entry in A1
    By Biff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-02-2005, 11:45 PM
  5. [SOLVED] Restricting data entry
    By JT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 04:05 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