|
1. 先复制粘贴各个工作表数据到最后一个工作表里,这一步可以用VBA来完成!
见传上的excel文件!
上榜生.rar
(17.58 KB, 下载次数: 14)
2. 再创建数据透视表就很容易了!可以用代码创建,这就不写代码了!
Option Explicit
Sub yj()
Dim sht As Worksheet
Dim i&, Num&
Application.ScreenUpdating = False
Sheet5.Range("A3:E65536").Clear
For Each sht In Sheets
If sht.CodeName <> "Sheet5" Then
With sht
i = .[a65536].End(xlUp).Row
Num = Sheet5.[a65536].End(xlUp).Row
.Range(.Cells(3, 1), .Cells(i, 5)).Copy Sheet5.Cells(Num + 1, 1)
End With
End If
Next
Num = Sheet5.[a65536].End(xlUp).Row
Sheet5.Range(Sheet5.Cells(3, 1), Sheet5.Cells(Num, 5)).Borders().LineStyle = xlContinuous
Application.ScreenUpdating = True
End Sub |
|