我有一个包含~3500行和5列的电子表格。
A列包含网址。一些URL是完全限定的域,一些包含具有相同FQD的多个子目录。
我想删除所有重叠的网址,但完全限定的域名(www.example.com)
例如,我可能会有以下内容:
www.example.com
www.example.com/sub-directory-a
www.example.com/sub-directory-b
www.example.com/sub-directory-a/sub-c/sub-d
我需要删除除 www.example.com
之外的所有行答案 0 :(得分:2)
使用“/”
删除所有行Sub RowKiller()
Dim F As Range, rKill As Range
Set F = Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp))
Set rKill = Nothing
For Each r In F
v = r.Text
If v Like "*/*" Then
If rKill Is Nothing Then
Set rKill = r
Else
Set rKill = Union(r, rKill)
End If
End If
Next r
If Not rKill Is Nothing Then
rKill.EntireRow.Delete
End If
End Sub