Results 1 to 3 of 3

Thread: EXCEL: Position sheet view in window ???

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Resolved EXCEL: Position sheet view in window ???

    Esteemed Forum Participants and Lurkers:
    ==============================
    **** Excel 97 ****

    I am trying to position a worksheet in a window. I have five header rows and one column frozen (Menu Bar > Window > Freeze Panes) and I can search and find the current date in the left column. What I want to do is to make the row for the CURRENT DATE the FIRST ROW viewed under the frozen pane rows. I am doing this in an "Auto_Open" macro to open the workbook with the optimal view for the user. I want to immediately view as much data as possible starting from the selected date, and data from previous dates is worthless (to view - don't suggest deleting it!).

    I can get close ... I select the bottom date cell in the sheet, and then walk up the sheet selecting cells until I get to the current date. This only guarantees that the selected cell is within the viewing area ... but I want it at the top of the moveable viewing pane just like I can accomplish by cliking the scroll bar 'up arrow" with the mouse.

    Does anyone have any idea as to how to accomplish this?
    Last edited by Webtest; Dec 1st, 2004 at 09:34 AM.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    VB Code:
    1. Dim intRowCounter As Integer
    2.  
    3. For intRowCounter = 1 To UsedRange.SpecialCells(xlCellTypeLastCell).Row
    4.     If CStr(Trim(Cells(intRowCounter, 1))) = CStr(Format(Now, "dd/mm/yyyy")) Then
    5.         Application.Goto Cells(intRowCounter, 1), True
    6.     End If
    7. Next intRowCounter
    The Goto command has a useful 2nd Scroll parameter/argument which, when set to true will do exactly what you're after!!!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045
    Alex_read:

    Well, I survived the holidays and the crunch at work these past 2 days.

    Thank you very much for your gracious assistance. The second parameter boolean for "Goto" was indeed exactly what I needed! It works perfectly.

    I had actually tried a kludge fix ... after I found the correct row and selected it, I set the height to the maximum of 409, reselected the row, and then set the height back to the correct value (12.75). Your way of doing it is much better. Thanks again.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Click Here to Expand Forum to Full Width