Reputation: 245
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
Upvotes: 0
Views: 2245
Reputation:
Using Case
is a solution.
Array
is another solution. You can populate your values to an array and do a For Loop
for each value in the array.
Answer to similar question:
Upvotes: 1