FREEZING TOP ROW IN MULTIPLE WORKSHEETS

venumkd

New Member
Joined
Feb 4, 2020
Messages
45
Office Version
  1. 2010
Sirs,

Is it possible to FREEZE TOP ROW of multiple / selected worksheets (500 to 1000 Nos.) in a workbook based on cell values?

The sheet numbers / Names to be top freezed shall be mentioned in the first worksheet in Column A beginning with A1 or wherever you suggest

Thanks & Regards

VENU
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
How about a script to freeze top row of all sheets in your workbook. Would that work?
And this would require Vba
 
Upvote 0
No sir
It should not be for all sheets. It will not work out.
It has to be only for selected sheets. Even for upto 100 sheets can be managed.
Thanks & Regards
VENU
 
Upvote 0
Saying only selected sheets when you have more then one will not work.
Or saying you will enter sheet name or sheet number in column A of sheet 1 could be difficult
A sheet name and a sheet number are different
So if the script sees 23 does that mean the sheet is named 23 or is sheet 23 is not easy for me to deal with.
Now if you said sheets 1 to 200 that could be easy.
But maybe someone else here on the forum will be to help you.
 
Upvote 0
The sheet .. Names to be top freezed shall be mentioned in the first worksheet in Column A beginning with A1 ...
Try this

VBA Code:
Sub Freeze_Panes()
    Dim c As Range
    
    Application.ScreenUpdating = False
    For Each c In Sheets(1).Range("A1").CurrentRegion.Resize(, 1)
      Application.Goto Sheets(c.Text).Range("A2")
      ActiveWindow.FreezePanes = True
    Next c
    Application.ScreenUpdating = True
  End Sub
 
Upvote 0
Hi, Sir,
FANTASTIC. It is WORKING EXACTLY as per my requirement.
Thans a lot. Also please let me know what changes are to be made for Unfreeaing those frozen rows?
I may require few more help/
Thanks & Regards
VENU
 
Upvote 0
Hi, Sir,
FANTASTIC. It is WORKING EXACTLY as per my requirement.
Good news. !

what changes are to be made for Unfreeaing those frozen rows?
You could use this ..

VBA Code:
Sub UnFreeze_Panes()
  Dim c As Range
 
  Application.ScreenUpdating = False
  For Each c In Sheets(1).Range("A1").CurrentRegion.Resize(, 1)
    Sheets(c.Text).Activate
    ActiveWindow.FreezePanes = False
  Next c
  Application.ScreenUpdating = True
End Sub


.. or perhaps this which will toggle those sheets freeze panes on if they are off and off if they are on. I have also added code so that after the code has executed, you will be left on the sheet you were on when the code was triggered.

VBA Code:
Sub Toggle_Freeze_Panes()
  Dim c As Range
  Dim wsAct As Worksheet
  
  Application.ScreenUpdating = False
  Set wsAct = ActiveSheet
  For Each c In Sheets(1).Range("A1").CurrentRegion.Resize(, 1)
    Application.Goto Sheets(c.Text).Range("A2")
    ActiveWindow.FreezePanes = Not ActiveWindow.FreezePanes
  Next c
  wsAct.Activate
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi, Sir,
FANTASTIC. It is WORKING EXACTLY as per my requirement.
Thanks a lot.
I may require few more helps / I will post.
Thanks & Regards
VENU
 
Upvote 0
Hi, Sir,
FANTASTIC. It is WORKING EXACTLY as per my requirement.
Thanks a lot.
You're welcome. Glad it was what you wanted.


I may require few more helps / I will post.
That is fine, though unless the question is a direct follow-on from this one or very closely related, start a new thread for each question.
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

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