|
- Sub 员工考核明细导出到分表()
- arr = Sheet1.UsedRange
- Dim dic As Object
- Set dic = CreateObject("scripting.dictionary")
- For i = 4 To UBound(arr)
- If arr(i, 4) <> Empty Then
- Key = arr(i, 4)
- If Not dic.Exists(Key) Then
- dic(Key) = i
- Else
- dic(Key) = dic(Key) & "," & i
- End If
- End If
- Next
- Application.DisplayAlerts = False '不显示警告框
- Dim sht As Worksheet
- For Each sht In Worksheets
- If sht.Name <> "总表" Then
- sht.Delete
- End If
- Next
- Application.DisplayAlerts = True '恢复显示警告框
- keys = dic.keys
- items = dic.items
- Dim sh As Worksheet
- For i = 0 To dic.Count - 1
- Set sh = Worksheets.Add(After:=Worksheets(Worksheets.Count))
- sh.Name = keys(i)
- Sheet1.Range("B3:D3,G3:T3").Copy sh.Range("A1")
- temp = Split(items(i), ",")
- ReDim brr(1 To UBound(arr), 1 To 17)
- For m = 0 To UBound(temp)
- k = k + 1
- 行号 = temp(m)
- For j = 7 To 20
- brr(k, 1) = arr(行号, 2)
- brr(k, 2) = arr(行号, 3)
- brr(k, 3) = arr(行号, 4)
- brr(k, j - 3) = arr(行号, j)
- Next
- sh.Range("A2").Resize(k, 17) = brr
- sh.Range("A1").CurrentRegion.Borders.LineStyle = xlContinuous '加边框
- Next
- k = 0
- j = 0
- Next
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|