Group Editing

T

Thomas M.

Excel 2007

I would like to freeze the top row in all of the worksheets in a workbook.
I remember from earlier versions of Excel that it is possible group all the
sheets together, then edit one sheet and have that change show up on all
sheets. That works if I actually change the contents of a cell, but it does
not seem to work for something like freezing the top row of each worksheet.
What is the best way to freeze the top row of each worksheet?

Thanks for any help that you can offer!

--Tom
 
G

Gord Dibben

Sub freeze_line()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Application.ScreenUpdating = False
ws.Activate
Range("A2").Select 'adjust A2 to suit
ActiveWindow.FreezePanes = True
Next ws
Application.ScreenUpdating = True
End Sub

Assumes no Chart Sheets


Gord Dibben MS Excel MVP
 
O

ozgrid.com

Hi Tom

Use;

Sub FreezePanes()
Dim ws As Worksheet
Dim rCell As Range

Set rCell = ActiveCell
Application.ScreenUpdating = False
For Each ws In Worksheets
Application.Goto ws.Range("A2")
ActiveWindow.FreezePanes = True
Next ws
With Application
.Goto rCell
.ScreenUpdating = True
End With

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