|
Sub 筛选拆分()
Application.ScreenUpdating = False
Dim ar As Variant
Dim br()
Application.DisplayAlerts = False
For Each sht In Worksheets
If sht.Index > 1 Then
sht.Delete
End If
Next sht
Application.DisplayAlerts = True
With Sheets("原始成绩")
r = .Cells(Rows.Count, 2).End(xlUp).Row
y = .Cells(1, Columns.Count).End(xlToLeft).Column
ar = .Range(.Cells(1, 1), .Cells(r, y))
End With
For j = 5 To UBound(ar, 2) Step 2
n = 0
ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))
n = 1
For s = 1 To UBound(ar, 2)
br(n, s) = ar(1, s)
Next s
If Trim(ar(1, j + 1)) <> "" Then
For i = 1 To UBound(ar)
If Trim(ar(i, j + 1)) <> "" Then
If ar(i, j + 1) <= 1000 Then
n = n + 1
For s = 1 To UBound(ar, 2)
br(n, s) = ar(i, s)
Next s
End If
End If
Next i
End If
If n > 1 Then
Set sh = Worksheets.Add(after:=Sheets(Sheets.Count))
sh.Name = ar(1, j)
sh.[a1].Resize(n, UBound(br, 2)) = br
sh.[a1].Resize(n, UBound(br, 2)).Borders.LineStyle = 1
sh.Columns("a:iv").AutoFit
End If
Next j
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|