Centering the Active Cell in the Center of the Screen


Posted by PaulC on December 21, 2001 2:45 PM


If your active cell is "A1", and your VBA Code is simply this:
Range("Z1").Select

How do you add to the code to get "Column Z" to appear in the center of your screen, rather than off to the right side of the screen?

There is probably a very simple answer to this question.

Thanks for any help.

Posted by Paul Johnson on December 21, 2001 5:11 PM

You can set the scrollarea so that the column z is the only active column and also use freez panes.

PJ



Posted by Ivan F Moala on December 21, 2001 11:32 PM

Try something like this;

Sub ScrollCetre()
Dim ColVis As Single

ColVis = ActiveWindow.VisibleRange.Columns.Count
Application.Goto Reference:=Range("Z1"), scroll:=True
ActiveWindow.SmallScroll Toleft:=ColVis \ 2
End Sub

hth

ivan