Returning reference of frozen cell
Dim X as long
dim Y as long
With ActiveWindow.Panes(4)
Y = .ScrollColumn
X = .ScrollRow
End With
From my quick experiment with this "pane" stuff, I concluded using the
hard-coded 4 might fail if the spreadsheet were only split at the columns
only or the rows only (there would only be 2 panes then). My solution,
applied to your setup would be something like this...
Dim X as long
Dim Y as long
Dim MaxPane as Long
MaxPane = ActiveWindow.Panes.Count
With ActiveWindow.Panes(MaxPane)
Y = .ScrollColumn
X = .ScrollRow
End With
Actually, more in keeping with your original structure and the With
statement block, perhaps this instead...
Dim X As Long
Dim Y As Long
With ActiveWindow.Panes
Y = .Item(.Count).ScrollColumn
X = .Item(.Count).ScrollRow
End With
Although we lose the self-documenting MaxPane variable name this way.
Rick
|