+ Reply to Thread
Results 1 to 3 of 3

Selecting cells/rows

  1. #1
    Registered User
    Join Date
    12-05-2003
    Posts
    12

    Selecting cells/rows

    Hi,

    I've written some simple VBA to look for the current date in my workbook and select the row its on, using the Sub auto_open(). The problem is that the selected row can sometimes appear half way down the screen and I would like it to be the first row.

    This is the code:
    For Each c In [b1:b150]
    If c = Date Then
    'Rows(c.Row).Select
    Rows(c.Row & ":" & (c.Row + 20)).Select
    End
    End If
    Next c

    Any ideas?

    Thanks in advance,
    Dan

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064
    Am no expert but could you use the ScrollRow property? It tells you the number of the row that appears at the top of the pane/window. VBA Help says you can set this value too so I guess if what you want is on row 149 and you just set ScrollRow to 149 then you should end up with row 149 at the top of your window
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    12-05-2003
    Posts
    12

    Thumbs up

    Great :-)

    That has done the trick, thanks.

+ 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