VBA小程序--针对所有已经打开的Excel文件_格式调整_针对所有工作表_冻结首行_无视所在位置
Function 格式调整_针对所有工作表_冻结首行_无视所在位置()
Dim sht As Worksheet
For Each sht In Worksheets
sht.Activate
With Cells
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "微软雅黑"
.Font.Size = 10
End With
Cells.EntireColumn.AutoFit
Range("A1").Select
With ActiveWindow
.ScrollRow = 1 '当前窗口最上面的行号,相当于移动最右侧的滚动条
.SplitColumn = 0 '拆分(冻结)窗口,保留第几列
.SplitRow = 1 '拆分(冻结)窗口,保留第几行
End With
ActiveWindow.FreezePanes = True '微软官方:这是可能的FreezePanes是真正的和拆分为假,反之亦然。如果拆分窗格被冻结,则为True。读/写布尔值。
Next
End Function
Sub 格式调整_针对所有已经打开的工作簿()
For Each sht1 In Workbooks
Debug.Print (sht1.Name)
sht1.Activate
Call 格式调整_针对所有工作表_冻结首行_无视所在位置
Next
MsgBox ("兄台,已完成")
End Sub