Sub 成績表分類()
Dim Sht As Worksheet
For Each Sht In Sheets(Array("英文科", "歷史科", "物理科"))
Intersect(Sht.[A:G], Sht.UsedRange).Offset(1, 0).ClearContents '清除內容
With Intersect(Sheets("成績表").[A:F], Sheets("成績表").UsedRange)
.AutoFilter Field:=3, Criteria1:=Sht.Name '以工作表名稱篩選
.Columns(1).Offset(1, 0).Resize(, 6).Copy Sht.[A2] '複製A~E欄
.Columns(6).Offset(1, 0).Copy Sht.[G2] '複製備註欄
End With
Next
Sheets("成績表").AutoFilterMode = False
End Sub
Sub 清空本表()
Intersect([A:G], ActiveSheet.UsedRange).Offset(1, 0).ClearContents
End Sub
Sub 清空各分類表()
Dim Sht As Worksheet
For Each Sht In Sheets(Array("英文科", "歷史科", "物理科"))
Intersect(Sht.[A:G], Sht.UsedRange).Offset(1, 0).ClearContents
Next
End Sub