|
如何设置冻结窗口:
Public Sub 创建第1次大考成绩表()
Dim Nowbook As Workbook
Dim ShName As Variant
Dim Arr As Variant
Dim i As Integer
Dim myNewWorkbook As Integer
myNewWorkbook = Application.SheetsInNewWorkbook
ShName = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16")
Arr = Array("考号", "姓名", "班号", "政治", "语文", "数学", "英语", "物理", "化学", "历史", "地理", "生物", "电脑")
Application.SheetsInNewWorkbook = 16
Set Nowbook = Workbooks.Add
With Nowbook
For i = 1 To 16
With .Sheets(i)
.Name = ShName(i - 1)
.Range("A1").Resize(1, UBound(Arr) + 1) = Arr
.range("d2").FreezePanes = True '设置冻结窗口
.Columns("c:m").ColumnWidth = 5 '设置列宽
End With
Next
.SaveAs Filename:=ThisWorkbook.Path & "\数据库\" & "第1次大考成绩表.xls"
' Call 标签颜色
.Close Savechanges:=True
End With
Set Nowbook = Nothing
Application.SheetsInNewWorkbook = myNewWorkbook
MsgBox "第1次大考成绩表<" & myTable & ">创建成功!", _
vbOKOnly + vbInformation, "创建数据表"
Set myAccess = Nothing
End Sub
|
|