lundi 30 octobre 2017

VBA InStr with multiple Strings

I want to check multiple strings with InStr and replace them if necessary.

Something like:

s1 = "ABC"  s2 = "ABCD" s3 = "ABCDE"

If InStr(s1,"D") <> 0 Then
   s1 = ""
End If
If InStr(s2,"D") <> 0 Then
   s2 = ""
End If
If InStr(s3,"D") <> 0 Then
   s3 = ""
End If

I'm sure there is a easier and more intuitive way to do this but i just dont know how.
Maybe with Loop or Case ?

Thanks in Advance

Aucun commentaire:

Enregistrer un commentaire