• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 475
  • Last Modified:

Display active cell in left center of screen

On open in "thisworkbook", put cursor on one cell below last cell with data and make that cursor appear on left center of screen.  Thanks for your help!
0
1r3o2n8
Asked:
1r3o2n8
1 Solution
 
Rory ArchibaldCommented:
Something like this:

Private Sub Workbook_Open()
    Dim rngVis As Range
    Dim lngRow As Long, lngCol As Long
    Dim win As Window
    
    ' assumes column A for data check
    lngCol = 1
    Set win = ThisWorkbook.Windows(1)
    With ThisWorkbook.ActiveSheet
        Set rngVis = win.VisibleRange
        Debug.Print rngVis.Address
        ' get last row with data in col A
        lngRow = .Cells(.Rows.Count, lngCol).End(xlUp).Row + 1
        .Cells(lngRow, lngCol).Select
    End With
    With win
        .ScrollColumn = lngCol
        .ScrollRow = Application.Max(lngRow - (rngVis.Rows.Count / 2), 1)
    End With
        
End Sub

Open in new window

0
 
1r3o2n8Author Commented:
It executed perfectly the first time.  Thanks so much !
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now