从帮助文档里复制的代码,并进行修改。现情况如下,输入落实人,单击查询,可筛选;选择开始和结束日期,单击筛选,所有行消失。代码如下:Dim Filter As String
With RibbonTabs("Workday").Groups("Filter").Items("cmbCustomer")
If .Text IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "落实人 = '" & .Text & "'"
End If
End With
With RibbonTabs("Workday").Groups("Filter").Items("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "发布日期 >= #" & .Value & "#"
End If
End With
With RibbonTabs("Workday").Groups("Filter").Items("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "发布日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("工作安排").Filter = Filter
End If
另外,如何实现筛选包含某名字的行(落实人可能某个表格中有张三李四,此代码只能搜索只含有张三的行,同时包含张三李四的行无法筛选出来)