我有一长串字符串,例如:
GREENCAT-01-AB-01
BLUEDOG-800-CC-1
BLUECAT-1
GREENDOG-804
BLACKSHEEP-58
PINKMOUSE-900-AB
期望的结果:
BLUECAT-1
GREENDOG-804
BLACKSHEEP-58
我正在尝试使用Find函数查找具有第二个连字符的任何字符串并删除该行。我正在使用"外卡"但它们需要具体,一些字符串在第一个连字符后只有1或2个数字,而其他字符串则有3个或4个。
帮助?
Set SrchRng = WS.Range("A1:A" & LastRow)
Do
Set c = SrchRng.Find(What:="-***-", LookAt:=xlPart)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing
答案 0 :(得分:2)
只需在“What”参数的开头和结尾添加“*”
Set SrchRng = ws.Range("A1:A" & lastRow)
Do
Set c = SrchRng.Find(What:="*-*-*", LookAt:=xlPart)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing