On Sheet Activate code

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,471
I have defined a sheet with a Scroll Area = "A1:K27" setting it thusly in the Sheet_Activate Event. At present
it opens way off to the left hand side of the window. I'm interested in CENTERING - IT, but can't seem to get the
code I need. I tried Chip Pearson's "Center on Cell" macro but it didn't work. Has anyone else got any ideas?

TIA,

Jim
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,761
Office Version
2013
Platform
Windows
Does this work:

Code:
Private Sub Worksheet_Activate()
'Modified  2/6/2019  7:31:54 PM  EST
ScrollArea = "A1:K27"
  Dim i As Long
  Dim j As Long
        With ActiveWindow
            i = .VisibleRange.Rows.Count / 2
            j = .VisibleRange.Columns.Count / 2
            .SmallScroll Up:=i, ToLeft:=j
        End With
End Sub
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,835
Office Version
2010
Platform
Windows
I don't understand what you mean by "CENTERING - IT". There are no columns to the left of col A and no rows above row 1.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,091
Messages
5,466,579
Members
406,490
Latest member
Ankusharma

This Week's Hot Topics

Top