How to Freeze Panes at a Specific sheet

9kitti

New Member
Joined
Jul 4, 2021
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
I have 5 main sheets and want to freeze pane lines starting from sheet 6, row 7, column 2. What do I have to do? Thank you.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Freeze panes is independent from one sheet to the next, so you can have freeze panes not set for sheets 1-5 and then set it for sheet 6 and onward to wherever you want it to be. Unfortunately you cannot select a group of sheets and set them all the same, as far as I know, so they need to be done individually.

Regards

Murray
 
Upvote 1
Freeze panes is independent from one sheet to the next, so you can have freeze panes not set for sheets 1-5 and then set it for sheet 6 and onward to wherever you want it to be. Unfortunately you cannot select a group of sheets and set them all the same, as far as I know, so they need to be done individually.

Regards

Murray
i use this code but error
VBA Code:
Sub moFreeze()
    Dim sh As Worksheet
    Application.DisplayAlerts = False
    For Each sh In Worksheets
        If sh.Index > 5 Then
            'With Sheets("Main")
            With sh
          If .FreezePanes Then .FreezePanes = False
            .SplitColumn = 2
            .SplitRow = 7
            .FreezePanes = True
                End With
            End If
        End If
    Next sh
   Application.DisplayAlerts = True
End Sub
 
Upvote 0
Try this instead.

VBA Code:
Sub moFreeze()
    Dim sh As Worksheet
    Application.DisplayAlerts = False
    For Each sh In Worksheets
        If sh.Index > 5 Then
            sh.Activate
            With ActiveWindow
                If .FreezePanes Then .FreezePanes = False
                .SplitColumn = 2
                .SplitRow = 7
                .FreezePanes = True
            End With
        End If
    Next sh
   Application.DisplayAlerts = True
End Sub

Regards

Murray
 
Upvote 1
Thank you. It is my boss's wish. You saved my life a lot. Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top