![]() |
|
#1
|
|||
|
|||
|
How do you count how many alphabets there are in a sentence? I did a search and found only "how to count how many characters in the whole script" but not how many alphabets/characters are there in a sentence.
|
|
#2
|
||||
|
||||
|
Simly select the range you want the stats for, then click on the 'Word Count' button on Word's status bar.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
||||
|
||||
|
The following macro will count the unique occurrences of each character in a string thus
Lorem will have five unique characters and Lorem ipsum will have ten unique characters (including the space). mummy will have three unique characters. Code:
Sub CountUniqueChars()
Dim Col As Collection
Dim oRng As Range
Dim i As Integer
If Len(Selection.Range) > 0 Then
Set oRng = Selection.Range
Set Col = New Collection
On Error Resume Next
For i = 1 To Len(oRng)
Col.Add Mid(oRng.Text, i, 1), Mid(oRng.Text, i, 1)
Next i
MsgBox Col.Count
Else
MsgBox "Nothing selected"
End If
lbl_Exit:
Set Col = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
| Tags |
| alphabets, characters |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Getting the Count formula to count all rows
|
Jennifer Murphy | Word Tables | 11 | 08-23-2016 09:37 PM |
| Convert alphabets to numeric values | kjxavier | Word | 3 | 07-06-2014 05:34 AM |
| Convert numeric values with decimals to alphabets | kjxavier | Word | 1 | 07-06-2014 01:44 AM |
Delete does not bring second sentence closer to first sentence
|
Andoheb | Word | 29 | 07-03-2014 01:48 PM |
Running alphabets at left margins and pinpoint cites at right margin
|
ghumdinger | Word | 3 | 05-05-2011 02:01 AM |