+ Reply to Thread
Results 1 to 1 of 1

Do for all cells below and above

  1. #1
    Forum Contributor
    Join Date
    11-16-2011
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    405

    Question Do for all cells below and above

    Hi guys,

    I want to use the double click event on my worksheet to hide certain rows in Column B.

    The user is to double click on a colour index = 2 cell, If they double click on anything but then the sub exits
    Once the statement above proves true then the macro needs to find the 'top' of the colour index = 2 range that the user double clicked in. This is identified by finding the first cell above the clicked cell that has colour index = 2 and a top border.
    Next is to find the first 'bottom' cell below the found 'top' cell that has no colour index (i.e. no fill) and has a bottom Border.
    The macro then hides all the rows between 'top'.Row and 'bottom'.Row, except for the top row.
    Then if the user double clicks on the now only visible 'top' row then the range below it unhides. This is identified by determining whether top.Row > range(top).offset(1,0).row > 1 (indicating that between these 2 rows there are hidden rows)

    So far i have:

    Please Login or Register  to view this content.
    But i dont have any measure for determining the last range to hide (as there is no bottom border on the last range). Without having to manually put in a bottom border i was hoping to include an OR statement into the last do loop that looks for Cells(nRow + i, 2).Borders(xlEdgeBRight).LineStyle <> xlContinuous. This row identifies that last row to be hidden at the bottom of the range.

    Also i have not yet got a way of unhiding the hidden rows as mentioned above

    Any help in these 2 problems would be much appreciated
    Regards
    Last edited by jordan2322; 06-19-2012 at 06:26 PM.

+ 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