共计 466 个字符,预计需要花费 2 分钟才能阅读完成。
大数据多行,Excel 重复行使用 Vbs 批量删除
Sub 删除重复行 ()
Dim i As long, j As long, k As Integer
Dim p As Long
Dim a As String, b As String
For i = 1 To 78119
If Sheet1.Cells(i, 1) <> “” Then
a = Sheet1.Cells(i, 1)
b = Sheet1.Cells(i, 2)
k = 0
p = 0
For j = i+1 To 78120
If a = Sheet1.Cells(j, 1) And b = Sheet1.Cells(j, 2) Then
p = p + Sheet1.Cells(j, 3)
k = k + 1
Sheet1.Cells(j, 1) = “”
Sheet1.Cells(j, 2) = “”
End If
Next j
If k <> 0 Then Sheet1.Cells(i, 3) = (p + Sheet1.Cells(i, 3)) / k
End If
Next i
End Sub
再用定位删除空白行即可。