Skip to Main Content

Test for empty string

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

Leave a Reply

Your email address will not be published. Required fields are marked *