小编Kum*_*uma的帖子

如果它们在列excel中一起删除重复项

如果一起找到重复项,我试图删除整行.如果没有找到,我想保留它而不删除.

For an example Column A:
Apple,
Apple,
Orange,
Orange,
Apple,
Apple,
Run Code Online (Sandbox Code Playgroud)

我需要输出为;

Apple,
Orange,
Apple, 
Run Code Online (Sandbox Code Playgroud)

我正在使用以下代码但尚未达到所需的输出(仅获得Apple,Orange).

   Sub FindDuplicates()
   Dim LastRow, matchFoundIndex, iCntr As Long
   LastRow = Cells(Rows.Count, "A").End(xlUp).Row
   For iCntr = 1 To LastRow      
   If Cells(iCntr, 1) <> "" Then
   matchFoundIndex = WorksheetFunction.Match(Cells(iCntr, 1), Range("A1:A" &      LastRow), 0)
   If iCntr <> matchFoundIndex Then
   Cells(iCntr, 10) = "Duplicate"
   End If
   End If
   Next

   last = Cells(Rows.Count, "J").End(xlUp).Row ' check results col for values
   For i = last To 2 Step …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

3
推荐指数
1
解决办法
64
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1