Sub CountWord() Dim rng As Range, cell As Range Dim cellWords, totalWords As Integer, content As String Set rng = Selection cellWords = 0 totalWords = 0 For Each cell In rng If Not cell.HasFormula Then content = cell.Value content = Trim(content) If content = "" Then cellWords = 0 Else cellWords = 1 End If Do While InStr(content, " ") > 0 content = Mid(content, InStr(content, " ")) content = Trim(content) cellWords = cellWords + 1 Loop totalWords = totalWords + cellWords End If Next cell MsgBox totalWords & " words found in the selected range." End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
19 Experts available now in Live!