+ Reply to Thread
Results 1 to 4 of 4

counting the number of characters in a cell w text

Hybrid View

  1. #1
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    counting the number of characters in a cell w text

    If I have a cell selected with text in it, is there a way to count how many characters it has via vb. How about characters and spaces?

    Thank you.
    Last edited by luv2glyd; 02-19-2011 at 12:53 PM.
    You either quit or become really good at it. There are no other choices.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: counting the number of characters in a cell w text

    How about...

    Sub CountCell()
        Dim rng As Range
        Dim ans As Long
        Set rng = Sheets("Sheet1").Range("A1")
        ans = Len(rng)
        MsgBox ans
    End Sub
    If you want to do the active cell then update with

    Set rng = ActiveCell
    Last edited by DonkeyOte; 02-19-2011 at 12:07 PM. Reason: corrected missing tag
    HTH
    Regards, Jeff

  3. #3
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: counting the number of characters in a cell w text

    Great! Thank you.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: counting the number of characters in a cell w text

    You're welcome...Glad it helped

+ 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