Forum Discussion

HOMBRECK's avatar
HOMBRECK
Copper Contributor
Aug 14, 2021

Hide row

I have a schedule with dates and other information.  I would like to have a row to hide when the date on it is passed, or even on the date.

 

Thank you 

Hombreck

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    HOMBRECK 

    Approach:

    Auto filter and filter by:> = TODAY ()

    Mark the entry in the line ... then:

    - "Data" menu

    - "filter" - "Autofilter"

    - select your desired column and activate "user-defined".

    Use AutoFilter to filter your data

    I'm not sure if the commands are the same in 365, since I have 2016. Therefore this link with the information for 365.

     

    If this is not what you want, it could also be done in VBA.

    hier a smal examble:

     

     

    Sub Hide_row()
        Dim tab1 As Worksheet
        Set tab1 = ThisWorkbook.Sheets("Tabelle1")
        Dim zeile As Integer
        
        zeile = 1
        Do While tab1.Cells(zeile, 2) <> ""
            If tab1.Cells(zeile, 2) < Int(Now()) Then
                Rows(zeile & ":" & zeile).EntireRow.Hidden = True
            End If
            zeile = zeile + 1
        Loop
    End Sub

     

     

    An Excel sample file is inserted.

     

    Wish you a nice day.

     

    Nikolino

    I know I don't know anything (Socrates)

     

    * Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Resources