+ Reply to Thread
Results 1 to 2 of 2

Need to set the max character limit of a text box in VBA to 4 digits

  1. #1
    Registered User
    Join Date
    02-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    1

    Need to set the max character limit of a text box in VBA to 4 digits

    Hi

    I am creating a user form as part of my Computing Coursework, and one of my text boxes needs to have a limit of how much the user can input it has to no more than 4 character and no less than 4 and they can only be numeric. I tried
    If Not Candidate.Value(IsNumeric(txtAmount)) And Not (Len(txtAmount) = 5) Then
    MsgBox "The Candidate number is either too short or incorrect"
    End If

    Even If Candidate.Value < 4 Then
    Msg

    None of them work they all don't work.

    If anyone can help, thanks in advance

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Need to set the max character limit of a text box in VBA to 4 digits

    think best way is to check before it goes to the textbox
    like this

    Please Login or Register  to view this content.
    Kind regards
    Leo

+ 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. Character limit in text box when linked to a cell?
    By mfernandes in forum Excel General
    Replies: 6
    Last Post: 01-08-2016, 07:45 AM
  2. Character Limit in Text Box
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-10-2015, 01:54 PM
  3. Replies: 1
    Last Post: 07-08-2014, 01:51 PM
  4. Replies: 1
    Last Post: 11-27-2013, 04:53 PM
  5. Replies: 2
    Last Post: 02-14-2010, 01:03 PM
  6. Text box character limit
    By Mickey in forum Excel General
    Replies: 0
    Last Post: 05-22-2006, 03:35 PM

Tags for this Thread

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