Test for empty string

Published on November 5, 2010

Using the VBA Len function to test for empty string values will improve the performance of your applications.


Dim strValue as String

'
' Typical method to test for empty string
'
If strValue = "" Then
MsgBox "String is empty"
End If

'
' Quicker method to test for empty string
'
If Len(strValue) = 0 Then
MsgBox "String is empty"
End If


Tags:
Like this article? Share it!

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Privacy Policy