more macro help - freeze panes

M

mastersparky

I have an excel 2003 spreadsheet with 215 identical pages - is there a macro
or formula to set the freeze pane function on all of them? The cell that
would need to be selected would be D6 on sheets1 to 215... Any help or
insight would be greatly appreciated

Thanks

mastersparky
 
R

Rick Rothstein

Assuming this is a continuation of your previous question and the worksheets
you want this are all named SheetX (where X is a number from 1 to 215), then
this macro will do what you want...

Sub FreezePanes()
Dim X As Long
On Error GoTo CleanUp
For X = 1 To 215
Application.ScreenUpdating = False
Worksheets("Sheet" & X).Activate
With ActiveWindow
.SplitRow = 6
.SplitColumn = 4
' Omit the next line if you want to Split
' the Panes rather than to Freeze the Panes
.FreezePanes = True
End With
Next
CleanUp:
Application.ScreenUpdating = True
End Sub
 
D

Dave Peterson

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Select
wks.Range("a1").Select 'so A1 is visible in the top left
wks.Range("d16").Select
ActiveWindow.FreezePanes = True
Next wks
End Sub
 
S

ShaneDevenshire

Hi,

Might as well throw my variation into the mix:

Sub FreezePanes()
Dim sh As Worksheet
For Each sh In Worksheets
sh.Activate
[D6].Select
ActiveWindow.FreezePanes = True
Next sh
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top