+ Reply to Thread
Results 1 to 5 of 5

Macro for hiding rows

  1. #1
    Forum Contributor
    Join Date
    06-24-2009
    Location
    Germany, MG
    MS-Off Ver
    Excel 2010
    Posts
    131

    Macro for hiding rows

    Hello everyone,

    I am trying to build an Excel-timesheet. For this timesheet I want to show just the weeks that aren't filled out and the current week.

    Please have a look at the attached example sheet, it will make it clearer.

    I was thinking about having a macro or function that allows me to enter something like:

    "if the cell in the same row, column B equals "Hours" AND cells D"rowindex":J"rowindex" are NOTEQUAL "", then hide this row and the row above"

    and also:

    "hide all future weeks"

    It doesn't necessarily have to be a macro or something, if anyone has a better idea, go ahead.
    Thx alot in advance and
    kind regards.
    Attached Files Attached Files
    Last edited by Cunner; 03-02-2010 at 05:49 AM.

  2. #2
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: Macro for hiding rows

    Hi Cunner ,

    Could you explain this a little simpler pls.
    I understand from your post that when a row is not filled in completely from column "D" till "J" then
    the active row and the row above should be hidden.

    in your example the macro or function should hide rows 6 and 7 if cells D7,E7,F7,G7,H7,I7,J7 have no data.
    Is this correct ?

  3. #3
    Forum Contributor
    Join Date
    06-24-2009
    Location
    Germany, MG
    MS-Off Ver
    Excel 2010
    Posts
    131

    Re: Macro for hiding rows

    Quote Originally Posted by MarMo View Post
    Hi Cunner ,

    Could you explain this a little simpler pls.
    I understand from your post that when a row is not filled in completely from column "D" till "J" then
    the active row and the row above should be hidden.

    in your example the macro or function should hide rows 6 and 7 if cells D7,E7,F7,G7,H7,I7,J7 have no data.
    Is this correct ?
    Thanks for your interest.

    Let me start by stating the objective:
    right now the sheet just shows all the weeks. This is s a little too much information on the sheet. So I want the users to see just the rows that they still need to fill in (and the respective Date-row), which means that they shall see all past weeks that they haven't filled out yet completely and the current week.
    So the macro (or whatever) shall hide all weeks that are completely filled out and all future weeks. That means, if we have Wednesday today, the week starting the next Monday shall be hidden.

    I hope that makes it clearer.

    Thanks a lot

  4. #4
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: Macro for hiding rows

    Hello Cunner ,
    I've attached a modified file with 2 buttons.(hide and unhide rows)
    the "unhide all" button unhides all rows in the worksheet.

    the "Hide " button will hide all rows where ALL cells for the Hours are completed.
    I still need to find out how to determine how to match the current day with the following monday to hide these rows as well.
    Perhaps you could analyze this code first to see if it meets your demand.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-24-2009
    Location
    Germany, MG
    MS-Off Ver
    Excel 2010
    Posts
    131

    Re: Macro for hiding rows

    Thanks, this is a great first step to make the sheet more workable.
    As I have no idea about VBA I might be completely of, but might there be a way to make the macro look for =TODAY() and then just hide all rows below the Hours row?

    And a more general thing:
    If I use the macro for several worksheets, do I always have to change the name of the worksheet in the macro or is there a general placeholder that references the active worksheet?
    Last edited by Cunner; 03-05-2010 at 02:01 AM.

+ 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