|
- Sub 按钮1_Click()
- Set d = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- arr = [a1].CurrentRegion
- Sheets("Q1分类汇总").UsedRange.ClearContents
- Sheets("Q2分类汇总").UsedRange.ClearContents
- [c1:n1].Copy Sheets("Q1分类汇总").[a1]
- [c1:n1].Copy Sheets("Q2分类汇总").[a1]
- For j = 2 To UBound(arr)
- If Len(arr(j, 1)) > 0 Then
- shnm = "Q1分类汇总"
- If arr(j, 1) = "Q2" Then
- shnm = "Q2分类汇总"
- End If
- If d.exists(arr(j, 1) & arr(j, 3)) Then
- r = d(arr(j, 1) & arr(j, 3))
- Else
- r = Sheets(shnm).Cells(Rows.Count, 1).End(3).Row + 1
- d(arr(j, 1) & arr(j, 3)) = r
- End If
- With Sheets(shnm)
- .Cells(r, 1) = arr(j, 3)
- For i = 4 To 14
- .Cells(r, i - 2) = arr(j, i) + .Cells(r, i - 2)
- Next i
- End With
- End If
- Next j
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|