+ Reply to Thread
Results 1 to 5 of 5

Using VBA to move screen selection

  1. #1
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400

    Using VBA to move screen selection

    I have a problem in that I've created code to create an autofilter on a set of data and the visible cells are pasted to a different sheet.
    This "results" sheet is giving me issues because the screen selection does not reset on the paste.

    For example if one search yields 1000 results I might scroll down and scan through the 1000 results. Then if I do another search that only yield 100 results unless I scrolled to the top of the results after the first search I'll see nothing but a blank page. This isn't an issue for me because I understand I need to scroll upwards to view the results. However this sheet will be used by others who will not be as familiar with it's functionality and I would like the screen to "reset" to the original position.
    Something that I would achieve by pressing "ctrl-home". I couldn't find a way to do this with cell activation or selection. does anyone have any ideas?

    I apologize for the confusing post but my problem lies in the face I can't describe my problem well enough to look it up in a manual/help file

    thanks in advance

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187
    try a

    range("A1").select

    it should just scroll you to the top of the page

    hope this helps

  3. #3
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by tony h
    try a

    range("A1").select

    it should just scroll you to the top of the page

    hope this helps
    that selects the cell, but doesn't "center" the screen to that point

    that's similar to what I had, if i carriage return or use an arrow key to move it'll reset the screen to the point but doesn't do it automatically

  4. #4
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122
    to do it in code use

    With ActiveWindow.Panes(ActiveWindow.Panes.Count)
    .SmallScroll Up:=Rows.Count, ToLeft:=Columns.Count
    .VisibleRange(1).Select
    End With

    you can run this at the end of your macro

  5. #5
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by peejay
    to do it in code use

    With ActiveWindow.Panes(ActiveWindow.Panes.Count)
    .SmallScroll Up:=Rows.Count, ToLeft:=Columns.Count
    .VisibleRange(1).Select
    End With

    you can run this at the end of your macro
    ah yes. thank you thank you

+ 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