+ Reply to Thread
Results 1 to 6 of 6

Hide/Unhide Based on Several Date Range

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2012
    Location
    Houston
    MS-Off Ver
    Excel 2003
    Posts
    4

    Hide/Unhide Based on Several Date Range

    Hi Everyone!

    I have a workbook of timesheets on each employee. I would like to hide/unhide a date range based on the dates I have entered in some other cells. This way it makes it easier to see ONLY a certain week on an employee without unhiding all the cells, hiding the ones I don't need, and then printing it for a manager.

    Timesheet dates are listed starting in A12
    I'd like a checkbox next to each date range.
    It would need to hide/unhide the rows based on the FROM/TO dates in:
    AA1 (FROM) AB1 (TO) (checkbox)
    AA2 (FROM) AB2 (TO) (checkbox)
    etc...

    timesheet.JPG
    dates.JPG

    Thank you!!!

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hide/Unhide Based on Several Date Range

    It would be good if you attach the file instead of the .jpg images.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-23-2012
    Location
    Houston
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Hide/Unhide Based on Several Date Range

    Sorry! Here's a sample. I haven't exactly decided the "placement" of the dates but this will give you an idea what I'm trying to do. This is just one worksheet but I have about 30 employees that I'd need to repeat this action for.

    Timesheet_Sample.xlsx

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hide/Unhide Based on Several Date Range

    At any point of time, how many date ranges will be selected?

  5. #5
    Registered User
    Join Date
    01-23-2012
    Location
    Houston
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Hide/Unhide Based on Several Date Range

    It would have to reference the entire date range and only hide/unhide the range between the 2 dates I reference...in this case, each reference would be a week long.

    Within a given week though, an EE may clock in and out several times for various reason:

    In at 8AM
    Out Lunch at 12PM
    In Lunch at 1PM
    Out at 5PM
    Call In at 8PM
    Out at 10PM

    And to make things even worse, they make throw in a Dr's appt mid-morning. So to have a set number of rows designated for a payroll week doesn't happen, unfortunately.

    Does that help explain it? :\

  6. #6
    Registered User
    Join Date
    01-23-2012
    Location
    Houston
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Hide/Unhide Based on Several Date Range

    Ok...I'm trying to work through this for those that need a solution as well. I'm trying to come up with a work-around. This is not perfect since I still need a quick way to unhide specific work weeks, but this works really fast

    In a column next to my dates, it places a 1 or a 0 depending if the date falls between 2 dates...plus one more week to give me room to add additional time for the same date (on call employees):
    =IF(AND(B97>=StartDate,B97<=EndDate+7),1, 0)

    Then, I created a macro using advanced autofilter to filter all the 1's.

    Sub HideZeros()
    ' HideZeros Macro
    ActiveSheet.Range("$A$11:$M$399").AutoFilter Field:=1, Criteria1:="1"
    Range("D11").Select
    End Sub

    I then assigned it to a button which I then copied to each timesheet. Easy and fast, but not exactly what I needed...
    Last edited by b2995; 03-21-2012 at 03:17 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