Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VBA公式删除包含重复数据的行_Vba_Excel - Fatal编程技术网

VBA公式删除包含重复数据的行

VBA公式删除包含重复数据的行,vba,excel,Vba,Excel,我有一个约3500行5列的电子表格 列A包含URL。有些URL是完全限定的域,有些包含具有相同FQD的多个子目录 我想删除除完全限定域(www.example.com)之外的所有重叠URL 例如,我可能有以下内容: 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.exa

我有一个约3500行5列的电子表格

列A包含URL。有些URL是完全限定的域,有些包含具有相同FQD的多个子目录

我想删除除完全限定域(www.example.com)之外的所有重叠URL

例如,我可能有以下内容:

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

删除带有“/”的所有行


使用FIND()和MID()的组合,然后在“数据”选项卡上删除重复项,或者使用“自动筛选”检查
/
,然后删除筛选后的数据即可开始;)有人能解释一下为什么我在这类问题上可能会收到3张反对票,这样我以后就可以纠正错误了吗?你的建议已经涵盖了自动筛选比这种方法更快:)@SiddharthRout谢谢,我会进一步研究这种方法:)
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