+ Reply to Thread
Results 1 to 2 of 2

How to display the cell it goes to at the centre of the monitor screen

Hybrid View

  1. #1
    cyberdude
    Guest

    How to display the cell it goes to at the centre of the monitor screen

    Hi,

    After I have entered a value, I go to the cell holding the value by the

    command Range.("cell_address").select to check what value I have
    entered. It always goes to the cell I selected. It sometimes display
    the target cell at the centre of the monitor screen but sometimes it
    doesn't. How can I always make it display the target cell at the
    centre of the monitor screen or somewhere as near it as possible?
    Thank you.


    David


  2. #2
    keepITcool
    Guest

    Re: How to display the cell it goes to at the centre of the monitor screen

    David,

    following seems to work...

    Sub Test()
    Centre Range("z123")
    End Sub


    Sub Centre(r As Range)
    Dim x&, y&
    Dim l&, u&
    Application.ScreenUpdating = False
    Application.Goto r, True

    With ActiveWindow
    With .VisibleRange
    x = .Left - .Width / 2 + ActiveCell.Width
    y = .Top - .Height / 2 + ActiveCell.Height
    l = .Columns.Count
    u = .Rows.Count
    End With

    Do While l > 0 And x > 0 And .VisibleRange.Left > x
    l = l - 1
    .SmallScroll ToLeft:=1
    Loop
    Do While u > 0 And y > 0 And .VisibleRange.Top > y
    u = u - 1
    .SmallScroll Up:=1
    Loop

    End With
    Application.ScreenUpdating = True

    End Sub


    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    cyberdude wrote in
    <news:<1153642385.791083.195760@i42g2000cwa.googlegroups.com>

    > Hi,
    >
    > After I have entered a value, I go to the cell holding the value by
    > the
    >
    > command Range.("cell_address").select to check what value I have
    > entered. It always goes to the cell I selected. It sometimes display
    > the target cell at the centre of the monitor screen but sometimes it
    > doesn't. How can I always make it display the target cell at the
    > centre of the monitor screen or somewhere as near it as possible?
    > Thank you.
    >
    >
    > David


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1