回答編集履歴
2
コード修正
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
EndRow = Range("E" & Rows.Count).End(xlUp).Row
|
22
22
|
|
23
|
-
For i = EndRow To
|
23
|
+
For i = EndRow To 3 Step -1
|
24
24
|
|
25
25
|
Set Hani = Range(Range("E2"), Range("E" & i - 1))
|
26
26
|
|
1
コード追加
test
CHANGED
@@ -49,3 +49,45 @@
|
|
49
49
|
End Sub
|
50
50
|
|
51
51
|
```
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
---
|
56
|
+
|
57
|
+
Dictionaryを使って重複チェックするコード例
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
```vba
|
62
|
+
|
63
|
+
Sub DataDelete2()
|
64
|
+
|
65
|
+
Dim d As Object
|
66
|
+
|
67
|
+
Set d = CreateObject("Scripting.Dictionary")
|
68
|
+
|
69
|
+
Dim EndRow As Long
|
70
|
+
|
71
|
+
EndRow = Range("E" & Rows.Count).End(xlUp).Row
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
Dim i As Long
|
76
|
+
|
77
|
+
For i = EndRow To 2 Step -1
|
78
|
+
|
79
|
+
If d.Exists(Cells(i, "E") & ";" & Cells(i, "I")) Then
|
80
|
+
|
81
|
+
Range("E" & i).EntireRow.Delete
|
82
|
+
|
83
|
+
Else
|
84
|
+
|
85
|
+
d(Cells(i, "E") & ";" & Cells(i, "I")) = i
|
86
|
+
|
87
|
+
End If
|
88
|
+
|
89
|
+
Next i
|
90
|
+
|
91
|
+
End Sub
|
92
|
+
|
93
|
+
```
|