VBA: Is there a way to tell what cell is the "frozen cell" where Freeze Panes was issued?

TomCon

Active Member
Joined
Mar 31, 2011
Messages
303
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Is there a way to find out what cell the Freeze Panes command was issued on? That is, what is the upper left cell of the bottom right quadrant in a window view with frozen panes?

What i really want to do is select that cell in a macro, that is, mimic what the Excel UI does when you do Ctl-Home in a window with frozen panes.

If you record a macro Excel does not do anything special to record Ctl-Home, it just records something like "Range("B2").Select", which of course is not usable in the general case, unless you could query what cell was selected when Freeze Panes was issued.

Thanks!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,557
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Give this a try...
VBA Code:
  With ActiveWindow.Panes(1).VisibleRange
    Cells(.Rows.Count + 1, .Columns.Count + 1).Select
  End With
 
Solution

Forum statistics

Threads
1,148,283
Messages
5,745,842
Members
423,981
Latest member
ph1l

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