MR ABALONE
MR ABALONE

Reputation: 27

Does the Right function have a wildcard feature?

I am trying to remove strings that end with "DL1" and "DL2" and "DL3" etc.

I came across the Right function with wildcard feature, however, it doesn't work this way.

sub removingDL()
dim item_description as string
dim i as integer
dim x as integer

item_description = cells(i,x)
if (Right (item_description,3) = "DL?") then   ' the issue is here 
    'remove it, let's just assume
end if 

end sub

Upvotes: 0

Views: 136

Answers (1)

BigBen
BigBen

Reputation: 50008

Use Like.

If item_description Like "*DL?" Then...

If you plan to loop through a range (unclear if that's your end goal), you can AutoFilter with Criteria1:="=*DL?" instead of looping.

Upvotes: 1

Related Questions