EXCEL VBA实现冻结窗格,并获取行号列号

冻结窗格的三种(冻结窗格、冻结首行、冻结首列)
EXCEL VBA实现冻结窗格,并获取行号列号
EXCEL VBA实现冻结窗格,并获取行号列号
EXCEL VBA实现冻结窗格,并获取行号列号
EXCEL VBA实现冻结窗格,并获取行号列号
EXCEL VBA实现冻结窗格,并获取行号列号

冻结窗格的三种(冻结窗格、冻结首行、冻结首列)代码如果

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

上一篇:使用ROW_NUMBER()查询:列名 'RowNumber' 无效。


下一篇:中国人工智能学会通讯——蚂蚁金服智能金融实践