|
▼まりな さん:
こんにちは〜
>以下のような作業をVBAで行いたいのですが
Dictionaryオブジェクトで重複チェックという方法もあります。
(↓ ちょっと煩雑ですが)
Sub Try1()
Dim i As Long, n As Long
Dim v
Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
With Range("A1", Cells(Rows.Count, 1).End(xlUp))
v = Application.Text(.Value, "@")
ReDim dup(1 To UBound(v), 0)
For i = 1 To UBound(v)
If dic.Exists(v(i, 1)) Then
n = dic(v(i, 1))
If n > 0 Then
dup(n, 0) = "重複"
dic(v(i, 1)) = 0
End If
dup(i, 0) = "重複"
Else
dic(v(i, 1)) = i
End If
Next
.Offset(, 14).Value = dup '15列目に 結果の配列貼付け
End With
Set dic = Nothing
End Sub
|
|