【问题标题】:Excel freeze a specific columnExcel冻结特定列
【发布时间】:2021-05-27 11:58:12
【问题描述】:

我只想冻结 Excel 工作表中的 S 列。不是来自 A-S,只是当我滚动过去时的 S 列。有没有办法。尝试在线搜索但找不到任何解决方案。 冻结窗格选项冻结从 A 到 S 的所有列。 请告诉我。

【问题讨论】:

  • 可能不可能。
  • 我认为“中间”列/行没有冻结窗格。你可以使用split panes

标签: excel excel-formula excel-2013


【解决方案1】:

您可以在工作表模块中使用此代码自动将split 应用/删除到您的窗口:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    'Declarations.
    Dim RngSplit As Range
    
    'Setting.
    Set RngSplit = Me.Range("S:S")
    
    'Focusing ActiveWindow.
    With ActiveWindow
        'Checking if ActiveWindow is already split.
        If .Panes.Count = 1 Then
            'Checking if the first visible column on the left is to the left of RngSplit column.
            If .ScrollColumn > RngSplit.Column Then
                'Splitting the ActiveWindow.
                .SplitColumn = 1
                .Panes(1).ScrollColumn = RngSplit.Column
            End If
        Else
            'Checking if the first visible column on the left in the second pane is to the right of or the actual RngSplit column.
            If .Panes(2).ScrollColumn <= RngSplit.Column Then
                'Unsplitting the ActiveWindow.
                .Split = False
            End If
        End If
    End With
        
End Sub

只要您更改选择,它就会激活。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多