Closed Thread
Results 1 to 11 of 11

checking number of characters in a cell macro

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    checking number of characters in a cell macro

    hey guys

    i have a problem counting the number of characters in each cell in column "A" in a sheet and checking if number of characters in a cell exceeds 5 characters.

    thanks in advance
    regards
    Last edited by mehdoush; 03-07-2009 at 09:41 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: checking number of characters in a cell macro

    Hello mehdoush,

    Do you need a VBA solution for this? You can get the length of cell using the =LEN(A1) formula. This formula could be placed in another cell to perform the check.

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

    Re: checking number of characters in a cell macro

    Since this is the programming forum I hope this is the answer you're looking for:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: checking number of characters in a cell macro

    thank you guys
    but in the code "selection" it should be replaced with the range which is column "A"

    how can i modify this ?

    regards

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: checking number of characters in a cell macro

    Hello mehdoush,

    Can you provide a sample of this code? You still didn't answer the question of whether you need a VBA solution or not.

  6. #6
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: checking number of characters in a cell macro

    thnks Leith for ur interest

    yes i do need vba

    here's a sample of code :

    Please Login or Register  to view this content.
    here i need "selection" to be defined (cells in range A:A), you see

    regards

  7. #7
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: checking number of characters in a cell macro

    any help plz

  8. #8
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: checking number of characters in a cell macro

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 04-08-2014 at 02:22 PM. Reason: Added a "reset" line of code in red so the macro can be run in succession and still work.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: checking number of characters in a cell macro

    awesome shg

    regards

  10. #10
    Registered User
    Join Date
    03-11-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: checking number of characters in a cell macro

    how to change back the highlighted cell to no color after correct it?

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

    Re: checking number of characters in a cell macro

    Be careful, Mohonnah, it's against forum rules to post questions of your own in other people's threads, it is referred to as hijacking in the Forum Rules.

    Since you may not have read the forum rules you agreed to, click on the link in the menu bar above and review them now to avoid problems later.


    AS this question is very relevant to the reusability of the macro solution provided, I have added a line of code in red to SHG's original code above. This will reset all the coloring prior to highlighting the ones that are too long.

    This thread is closed.

Closed Thread

Thread Information

Users Browsing this Thread

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

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