If Cells(2, 1) <> "" Then
ReDim Preserve a(1)
a(1) = Cells(2, 1)
End If
'取不同的学校名称
For j = 3 To Sheets(1).UsedRange.Rows.Count '注意工作表
alen = UBound(a)
flag = False
For k = 1 To alen
If Cells(j, 1) = a(k) Then
flag = True
End If
Next k
If Not flag Then
ReDim Preserve a(alen + 1)
a(alen + 1) = Cells(j, 1)
End If
Next j
'循环预览
Cells(1, 1).Select
Selection.AutoFilter
For i = 1 To UBound(a)
Selection.AutoFilter Field:=1, Criteria1:=a(i)
ActiveWindow.SelectedSheets.PrintPreview 'printout直接输出打印,要确定格式哦,否则....
Next i