أخي الكريم جرب هذا الكود
Sub WordCount()
cellContents = Trim(ActiveCell .Formula)
cellWordCount = 1
prevCharacter = ""
For i = 1 To Len(cellContents)
nextCharacter = Mid(cellContents, i, 1)
If (nextCharacter = " " Or nextCharacter = Chr(10)) And _
(prevCharacter <> " " And prevCharacter <> Chr(10)) Then
cellWordCount = cellWordCount 1
End If
prevCharacter = nextCharacter
Next i
If Len(cellContents) = 0 Then
cellWordCount = 0
End If
MsgBox "عدد الكلمات هو:" Str (cellWordCount)
End Sub
count_words.rar