View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Maurizio Borrelli Maurizio Borrelli is offline
external usenet poster
 
Posts: 10
Default Test if a string contains only whitespaces

Il giorno sabato 2 febbraio 2013 08:40:28 UTC+1, Robert Crandal ha scritto:

Maybe?...

Public Function HasOnlyWhiteSpaces(ByVal Text As String) As Boolean
With Application.WorksheetFunction
HasOnlyWhiteSpaces = Len(.Trim(.Clean(Text))) = 0
End With
End Function

--
Ciao!
Maurizio

Does Excel VBA have a built-in function to test if a
string variable contains ONLY whitespace characters?
For my purposes, a whitespace character can be any one of
the following: space, tab, or enter (carriage return).
I know regular expressions solves this easily, but I do
NOT want to use regular expressions for this. I'm just curious
if Excel has a built-in function to test if a string contains
1 or more of the above whitespace characters.