A fringe case perhaps, but your function would return TRUE if the cell contains only a prefix character. I think a generic UDF (without error handling) would be:
Public Function HasNullString(ByVal rngCell As Range) As Boolean
Dim rngFirstCell As Range
Set rngFirstCell = rngCell.Cells(1)
If Not VBA.IsEmpty(rngFirstCell) Then
If rngFirstCell.Formula = vbNullString Then
HasNullString = (VBA.LenB(rngCell.PrefixCharacter) = 0)
End If
End If
End Function
I haven't properly tested it, so I might have missed something.
I've never needed to use a function like this, so I think any problems with this would be fairly unusual.
Bookmarks