|
Sub 名单1()
Dim rng, rng1, rng2, rngsheet1, rng3, rng4, rngsheet2, rngsheet3 As Range
Set rng = Sheet1.Range("D3", "D81")
Set rngsheet1 = Sheet1.Range("D3", "D81")
Set rngsheet2 = Sheet2.Range("D3", "D81")
Set rngsheet3 = Sheet3.Range("D3", "D81")
ActiveSheet.Cells(1, 1).Resize(1, 16).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
ActiveSheet.Cells(1, 1) = "2014~2015学年度第一学期初三模拟考试成绩"
ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 16) = [{"测试类别","班名次","班级","姓名","语文","数学","英语","物理","化学","政治","历史","生物","地理","总分","级名次","级升降"}]
For Each rng1 In rng
For Each rng2 In rngsheet1
If rng2.Value = rng1.Value Then
rng2.Offset(0, -3).Resize(1, 16).Copy ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next
For Each rng3 In rngsheet2
If rng3.Value = rng1.Value Then
rng3.Offset(0, -3).Resize(1, 16).Copy ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next
For Each rng4 In rngsheet3
If rng4.Value = rng1.Value Then
rng4.Offset(0, -3).Resize(1, 16).Copy ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next
ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).Resize(1, 16).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
.Font.Name = "宋体"
.Font.Size = 16
.Font.Bold = True
End With
Selection.Merge
ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0) = "2014~2015学年度第一学期初三模拟考试成绩"
ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 16) = [{"测试类别","班名次","班级","姓名","语文","数学","英语","物理","化学","政治","历史","生物","地理","总分","级名次","级升降"}]
Next
ActiveSheet.Rows(ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row - 1 & ":" & ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row).Delete
End Sub
|
|