+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    08-18-2004
    Posts
    5

    Need macro to move down & select next visible row

    G'day,

    I am currently looking for a macro which will sequentially select the next visible row in a worksheet when the macro is triggered. I do have a macro which does work however it will select the next row whether that row is hidden or not. My company has a lot of data that is hidden either manually or by filter. I want the macro to be able to select the next visible row and ignore/skip those rows which have been hidden. Here is a copy of the base macro which works fine on a normal worksheet but has no provision to ignore/skip hidden rows:

    Sub SelectRowDown()
    If ActiveCell.Row < 65536 Then
    ActiveCell.Offset(1, 0).Select
    ActiveCell.EntireRow.Select

    End If

    End Sub

    If any one knows of a macro that can do this or any help in modifying the macro would be appreciated.

    Thanks
    Fartnuckles

  2. #2
    Valued Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    501
    let me see if I am understanding you correctly. You have a set of data from say rows 1 - 100 what you want is a macro which will take you to Row 100? or to say the next availible row which would be row 101?

  3. #3
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    Posts
    845
    One way to achieve this is to check the row height property. If row height is 0, then in must be a hidden row. I have make a simple change to your original code

    Sub SelectRowDown()
    If ActiveCell.Row < 65536 Then
    ActiveCell.Offset(1, 0).Select
    Do While ActiveCell.RowHeight = 0
    ActiveCell.Offset(1, 0).Select
    Loop
    ActiveCell.EntireRow.Select

    End If

    End Sub

    Regards

    Matt

  4. #4
    Registered User
    Join Date
    08-18-2004
    Posts
    5
    Thanks Mallycat - the modified macro does exactly what I want and works like a charm.

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.2.0