+ Reply to Thread
Results 1 to 6 of 6

Prevent typing past 140 characters

  1. #1
    Registered User
    Join Date
    11-01-2007
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2013
    Posts
    22

    Prevent typing past 140 characters

    Hi all,

    Is there a way to prevent a person from typing past a character limit?

    I know that in Data Validation you can set a character limit for the cell, but that doesn't prevent them from typing more than the limit, it just prevents the text from being accepted once they hit enter.
    Is there a way to limit the cell input so that once they reach say 140 characters whatever they continue typing doesn't appear?

    Or, perhaps once they reach 140 characters the cell/text color changes to red?

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080

    Re: Prevent typing past 140 characters

    It would have to via VBA but am no VBA expert
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

    Re: Prevent typing past 140 characters

    This in Worksheet

    Please Login or Register  to view this content.

    This in Userform

    Please Login or Register  to view this content.
    for exemple i used 7 characters in first column.
    Change the 7 to 140 and target column 1 to target range you want

    Kind regards
    Leo
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-01-2007
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2013
    Posts
    22

    Re: Prevent typing past 140 characters

    Hey Leo,

    Thanks for taking the time to make this, I really appreciate it. Unfortunately I'm running into the same problem as before that the person doesn't know that they've reached 140 characters until after hitting the character limit (with the data validation they get an error, with your more elegant solution it just truncates to the character limit).

    Is there a way to report "live", as it were, (similar to how Twitter shows characters remaining) so that once the 140 character limit is reached the user can't input any more or there's a visual indicator like text turning red or a separate cell which counts live as the person is typing (i.e. not waiting to see character count until after they've hit "enter").

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

    Re: Prevent typing past 140 characters

    there is a way, i see for it later this day

    cheers

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

    Re: Prevent typing past 140 characters

    a change in code for CommandButton1, and extra code in TextBox1_Change

    Please Login or Register  to view this content.
    as before change the 7 to 140 in real file, 3 times

    Kind regards
    Leo
    Attached Files Attached Files

+ 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. Replies: 2
    Last Post: 03-23-2015, 10:04 AM
  2. [SOLVED] Prevent typing in a cell
    By engmhelmy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2014, 10:02 AM
  3. Prevent Typing in Drop Down List Cells
    By yoss15 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-05-2013, 11:46 PM
  4. [SOLVED] Prevent User typing when Limit reached
    By wyscavern in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2012, 07:50 PM
  5. Restricting typing of special characters
    By flakedew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2012, 11:26 AM
  6. Prevent user from typing on worksheet?
    By okriskao in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2009, 04:09 PM
  7. Prevent User from Going Past a Certain Cell
    By Paige in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2005, 11:05 AM

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