Macro to freeze panes to all worksheets in my workbook.

Johnny Thunder

Well-known Member
Joined
Apr 9, 2010
Messages
693
Office Version
  1. 2016
Platform
  1. MacOS
Hello all,

I am trying to include code into the end of my macro that will look in all worksheets and freeze pane row $1:$1

Any ideas?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
For instance:

Code:
Sub Macro1()
    Application.ScreenUpdating = False
    For Each ws In ThisWorkbook.Worksheets
        ws.Activate
        With ActiveWindow
            .SplitColumn = 0: .SplitRow = 1
            .FreezePanes = True
        End With
    Next
End Sub
 
Upvote 0
Yes, since you asked for row 1.
 
Upvote 0
It won't hurt to test it out in a blank workbook...







Yes, you're right.
 
Upvote 0
LOL! Thanks!

You wouldn't happen to know how to execute something similiar that would be applied to all worksheets. I need to when printing a tab have row $1:$1 repeated?

When I use my macro to clear the worksheet contents it always removes print settings like that row repeat.
 
Upvote 0
Hey Wigi,


I am trying to remove all the freeze panes using the same macro and changing

Freezepanes = True to Freezepanes = False but not luck?


Any ideas on how to remove? I have a macro that deletes all contentbut it won't remove the freeze panes?
 
Upvote 0
Code:
ActiveWindow.FreezePanes = False

should work, inside the loop over the sheets.
 
Upvote 0
I have Excel 2007 and would like to know how to set up a macro that will unfreeze the current panes and freeze another pane for all worksheets in the file I am currently working in. Actually in the current setting, a certain line has been split (View - Split). So need to undo that and freeze panes on another line. I have developed the following code:

Sub Macro1()
Range("E9").Select</SPAN>
With ActiveWindow</SPAN>
.SplitColumn = 0</SPAN>
.SplitRow = 0</SPAN>
End With</SPAN>
Application.ScreenUpdating = False</SPAN>
For Each ws In ThisWorkbook.Worksheets</SPAN>
ws.Activate</SPAN>
With ActiveWindow</SPAN>
.SplitColumn = 4: .SplitRow = 7</SPAN>
.FreezePanes = True</SPAN>
End With</SPAN>
Next
</SPAN>End Sub

When I run this macro, it goes to my "personal" workbook and runs it. How do I save a macro and run it on my the file I am currently in? New to macros, so kindly be detailed.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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