|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
'变得复杂很多,也毫无意义
'没有排序功能。19楼中已作说明,你自己的帖子你都不知道?
'觉得你是在玩而不是在学,特别嗨是吧。
Option Explicit
Sub test()
Dim i As Long, j As Long, k As Long, n As Long, arr, dt, flag As Boolean, m As Long
Application.ScreenUpdating = False
dt = Timer
arr = Range("a3:c" & Cells(Rows.Count, "a").End(xlUp).Row + 1)
arr(UBound(arr, 1), 1) = "ABC": arr(UBound(arr, 1), 1) = "ABC": arr(UBound(arr, 1), 1) = "ABC"
ReDim brr(1 To UBound(arr, 1), 1 To 1) As String
For i = 1 To UBound(arr, 1) - 1
For j = i To UBound(arr, 1) - 1
m = 0: flag = False
For k = 1 To 3
If Len(arr(j, k)) = 0 Then
m = m + 1
Else
If Len(arr(j + 1, k)) > 0 Then
If arr(j, k) <> arr(j + 1, k) Then flag = True ': Exit For
End If
End If
Next
If flag Or m > 1 Then
If j > i Then
n = 0
For k = i To j
brr(k, 1) = "重复" & n: n = n + 1
Next
If m > 1 Then brr(j, 1) = "唯一"
Else
brr(j, 1) = "唯一"
End If
i = j: Exit For
End If
Next j, i
[d3].Resize(UBound(brr, 1)) = brr
Debug.Print Timer - dt
Application.ScreenUpdating = True
End Sub |
|