I have an Excel workbook that I want to programmatically set the active cell to the top left corner. in some cases, the windows have freezepane = true, and when that is the case, I want to set the active cell to the cell where the freeze is set. But I can’t see any way to get that cell reference. What am I missing?
You need to use the
ActiveWindow.SplitColumn to find if there are any panes which are frozen
Sub test() Dim Rw As Long, Col As Long 'change sheet as applicable Sheets("Sheet1").Select With ActiveWindow If .SplitRow = 0 And .SplitColumn = 0 Then 'no panes are frozen Sheets("Sheet1").Range("A1").Select Else Rw = .SplitRow + 1 Col = .SplitColumn + 1 'select top left cell below the freeze pane Sheets("Sheet1").Cells(Rw, Col).Select End If End With End Sub