Hi! Years ago I asked for a macro for counting Bold words in a text inside a cell for something I was doing, and a user gave me that code below:
And I thought It was right, but recently I started a new project and I tried to use that macro, but... Sometimes the numbers are good sometimes they're not, in one case is because a noun is repeated, in another case the nouns are repeated and the account is right, and I don't know what's the problem...
Someone can help me qith that?
VBA Code:
Function nBold(cell As Range) As Long
If cell.HasFormula Then Exit Function
Dim tmp, n As Integer, x As Integer
tmp = Split(Application.Trim(cell.Text))
For n = 0 To UBound(tmp)
x = x - cell.Characters(InStr(cell, tmp(n)), 1).Font.Bold
Next: nBold = x
End Function
And I thought It was right, but recently I started a new project and I tried to use that macro, but... Sometimes the numbers are good sometimes they're not, in one case is because a noun is repeated, in another case the nouns are repeated and the account is right, and I don't know what's the problem...
Someone can help me qith that?