冻结窗格的三种(冻结窗格、冻结首行、冻结首列)
冻结窗格的三种(冻结窗格、冻结首行、冻结首列)代码如果
Sub 冻结窗格()
ActiveWindow.FreezePanes = True
MsgBox "冻结单元格地址为:" & Replace(ActiveSheet.Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Address, "$", "")
End Sub
Sub 冻结首行窗格()
ActiveWindow.SplitColumn = 0
ActiveWindow.SplitRow = 1
ActiveWindow.FreezePanes = True
MsgBox "冻结的为第" & ActiveWindow.SplitRow & "行"
End Sub
Sub 冻结首列窗格()
With ActiveWindow
.SplitColumn = 1
.SplitRow = 0
End With
ActiveWindow.FreezePanes = True
MsgBox "冻结的为第:" & ActiveWindow.SplitColumn & "列"
End Sub
Sub 取消冻结窗格()
With ActiveWindow
.SplitColumn = 0
.SplitRow = 0
End With
ActiveWindow.FreezePanes = False
End Sub
Sub 冻结窗格地址()
If ActiveWindow.FreezePanes Then
MsgBox "冻结单元格地址为:" & Replace(ActiveSheet.Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Address, "$", "")
Else
MsgBox "未冻结单元格!"
End If
End Sub