|
- Private Sub CommandButton1_Click()
- Dim i%, j%, endRow%, dwNum%, s$, arr, brr(), d As Object
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheet2.[c2].CurrentRegion: dwNum = UBound(arr)
- For i = 2 To UBound(arr)
- s = arr(i, 11): d(s) = ""
- Next
- arr = Sheet1.[c2].CurrentRegion
- For i = 2 To UBound(arr)
- If arr(i, 12) <> "" Then
- s = arr(i, 12)
- If Not d.exists(s) Then
- d(s) = i: endRow = endRow + 1
- ReDim Preserve brr(1 To 13, 1 To endRow)
- For j = 1 To 13
- brr(j, endRow) = arr(d(s), j + 1)
- brr(11, endRow) = "'" & arr(d(s), 12)
- Next
- End If
- End If
- Next
- With Sheet2
- i = UBound(brr, 2)
- .Rows("2:" & i + 1).Insert Shift:=xlDown
- .Rows("2:" & i + 1).RowHeight = 13.5
- .Rows("2:" & i + 1).Font.Bold = False
- .Range("c2").Resize(i, UBound(brr)) = Application.Transpose(brr)
- i = .Cells(Rows.Count, "m").End(xlUp).Row - 1
- End With
- MsgBox "共计" & i & "人", , "提示"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|