Macro help with Freeze Panes

Dan Wilson

Active Member
Joined
Feb 5, 2006
Messages
448
Office Version
  1. 365
Platform
  1. Windows
Good day. I am running Excel out of Office365 (updated recently) in Windows 10 Home. After all the Macros and Formulas that I have created, I am having trouble with a simple Freeze Pane function. I have a worksheet that has over 125 Columns and over 200 Rows of data. The first four Rows of the worksheet are rows containing Totals of the data under them and I would like to freeze Rows 1 through 4 so that I can see the totals while I scroll down through the other rows that contain the data making those totals. I was able to freeze rows 1 through 4 manually, but I can't seem to make it work in a Macro. I appreciate any help with this.
Dan Wilson...
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,579
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub DanWilson()
   Range("A5").Select
   ActiveWindow.FreezePanes = True
End Sub
 

Dan Wilson

Active Member
Joined
Feb 5, 2006
Messages
448
Office Version
  1. 365
Platform
  1. Windows
Good day Fluff. Thank you for responding. I think I tried that already, but I'll try it again. Maybe I typed something wrong.
Thanks, Dan Wilson...
 

Dan Wilson

Active Member
Joined
Feb 5, 2006
Messages
448
Office Version
  1. 365
Platform
  1. Windows
Good day again Fluff. I tried your solution, but it does not work. It acts like there is something else going on that I can't find. Even when I UnFreeze and then manually Freeze sometimes it does not always work. Most of the time when I manually use the Unfreeze function, it leaves me with two separate Row 1 showings. If I select the upper Row 1 and scroll the mouse wheel, Row 1 shows all the data 3 or 4 rows at a time in the allocated space. If I select the lower Row 1, the scroll of the mouse wheel shows the same as it does when the Freeze is in place. When the Unfreeze does work, it leaves a thin gray line running up and down between Column A and Column B and another thin gray line running left to right under Row 1. It appears that is trying to show me the existing Freeze setting. I tired using Rows("1:6").Select and Rows("A1:A6").Select in your solution. Neither one works. If you have any other suggestions or can think of anything other setting that I need to check, please let me know.
Thanks, Dan Wilson...
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,579
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Are you Split, next to Freeze panes on the view tab?
 

Dan Wilson

Active Member
Joined
Feb 5, 2006
Messages
448
Office Version
  1. 365
Platform
  1. Windows
Good day Fluff. You hit it right on the head! In the View function, the Split option was in Gray. After examining the Macro, I found the following -

With ActiveWindow

.SplitColumn = 1

.SplitRow = 1

End With

I commented the four lines above in the Macro and all is well using Rows("6").Select followed by ActiveWindow.Freezepanes = True

Thank you for staying with me on this one. I learned something today.
Thanks, Dan Wilson...
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,579
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,674
Messages
5,626,210
Members
416,168
Latest member
tttt199623

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
Top