|
前のコードではダメです。
訂正します。
'=====================================================
Sub test()
Dim rng As Range
Dim wk As Variant
Dim ans As Collection
Set rng = Range("a2", Cells(Rows.Count, 1).End(xlUp))
If rng.Row > 1 And rng.Count > 1 Then
ReDim wk(1 To rng.Count)
With rng
wk = Evaluate("=transpose(if(countif(" & .Address & "," & .Address & ")>1,text(" & .Address _
& ",""0000""),""" & Chr(1) & """))")
wk1 = Filter(wk, Chr(1), False)
End With
Set ans = mk_unique_collection(wk1)
For idx = 1 To ans.Count
mes = mes & ans(idx) & vbLf
Next
MsgBox mes
End If
End Sub
'========================================================
Function mk_unique_collection(myarray)
Dim myclct As New Collection
On Error Resume Next
For idx = LBound(myarray) To UBound(myarray)
myclct.Add myarray(idx), myarray(idx)
Next
Set mk_unique_collection = myclct
Set myclct = Nothing
On Error GoTo 0
End Function
>まっ、参考程度に確認して下さい。
|
|