質問編集履歴

1

情報の追記

2021/12/09 09:14

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -83,3 +83,67 @@
83
83
  End Sub
84
84
 
85
85
  ```
86
+
87
+
88
+
89
+ ▼追記
90
+
91
+
92
+
93
+ ```VBA
94
+
95
+ Sub 回答者の重複をカウント()
96
+
97
+
98
+
99
+ Dim sh1 As Worksheet
100
+
101
+ Dim maxrow As Long
102
+
103
+ Dim wrow As Long
104
+
105
+ Dim dicT As Object
106
+
107
+ Dim key As String
108
+
109
+ Dim count1 As Long
110
+
111
+ count1 = 0
112
+
113
+
114
+
115
+ Set dicT = CreateObject("Scripting.Dictionary")
116
+
117
+ Set sh1 = Worksheets("rawdata")
118
+
119
+ maxrow = sh1.Cells(Rows.count, "B").End(xlUp).Row
120
+
121
+
122
+
123
+ For wrow = 2 To maxrow
124
+
125
+ key = sh1.Cells(wrow, "B").Value
126
+
127
+ If dicT.exists(key) = False Then
128
+
129
+ dicT(key) = True
130
+
131
+ Else
132
+
133
+ count1 = count1 + 1
134
+
135
+ End If
136
+
137
+ Next
138
+
139
+
140
+
141
+ '結果の表示
142
+
143
+ MsgBox "重複数:" & count1
144
+
145
+
146
+
147
+ End Sub
148
+
149
+ ```