hi,
how to compare part of the string
ex:
i have XX-BP-XXXXXXXXXXXXXXX

i want to check wherther the string starts with XX-BP
how can i do that

Hi,

use any of these:
Suppose
MyStr ="XX-BP-XXXXXXXXXXXXXXX"

If MyStr Like "XX-BP*" Then
  MsgBox "True"
Else
  MsgBox "False
End If

Or

If Left(MyStr,5) = "XX-BP" Then
  MsgBox "True"
Else
  MsgBox "False
End If

Or

If InStr(MyStr ,"XX-BP")>0  Then
  MsgBox "True"
Else
  MsgBox "False
End If

Regards
Veena