Right 函数是否具有通配符功能?
Does the Right function have a wildcard feature?
我正在尝试删除以 "DL1"、"DL2" 和 "DL3" 等结尾的字符串。
我遇到了具有通配符功能的 Right 函数,但是,它不能这样工作。
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
使用Like
.
If item_description Like "*DL?" Then...
如果您计划循环遍历一个范围(不清楚这是否是您的最终目标),您可以 AutoFilter
和 Criteria1:="=*DL?"
而不是循环。
我正在尝试删除以 "DL1"、"DL2" 和 "DL3" 等结尾的字符串。
我遇到了具有通配符功能的 Right 函数,但是,它不能这样工作。
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
使用Like
.
If item_description Like "*DL?" Then...
如果您计划循环遍历一个范围(不清楚这是否是您的最终目标),您可以 AutoFilter
和 Criteria1:="=*DL?"
而不是循环。