Sub a() Dim n%, myr%, d As Object, arr Set d = CreateObject("scripting.dictionary") '创建字典d myr = Cells(Rows.Count, 1).End(xlUp).Row '获取第一列非空行号 arr = Range("a2:b" & myr) '指定区域数据赋值到数组arr中 For n = 1 To UBound(arr) '循环A列 If d.exists(arr(n, 1)) Then d(arr(n, 1)) = d(arr(n, 1)) + arr(n, 2) Else d(arr(n, 1)) = arr(n, 2) End If Next n [d2].Resize(d.Count, 1) = Application.Transpose(d.keys) '输出宽度 [e2].Resize(d.Count, 1) = Application.Transpose(d.items) '输出打孔数量 End Sub'如有疑问加q:47436528