I am trying to filter out the dates for a pivot table field called Delivery Dates. The dates are in this format mm/dd/yyyy and I want to filter out based on the input of year. So for example, if the user select year 2020 then it will filter out all the dates that is in 2020. I was trying to do it with the match function but I am not sure how to go about doing it.
Dim pvtItem As PivotItem Dim year As String Dim pvt As PivotTable year = ComboBox3.Value Set pvt = ActiveSheet.PivotTables("PivotTable1") If year = "All" Then Else Sheet12.PivotTables("PivotTable1").PivotFields("Delivery Date").Orientation = xlPageField For Each pvtItem In pvt.PivotFields("Delivery Date").PivotItem If Not IsError(Application.Match(class, filterArr, 1)) Then pvtItem.Visible = True Else pvtItem.Visible = False End If Next pvtItem End If https://stackoverflow.com/questions/66540231/filter-out-certain-dates-in-this-format-mm-dd-yyyy-based-on-given-year-in-pivot March 09, 2021 at 11:07AM
没有评论:
发表评论