VBA控制显示隐藏自动筛选并按条件筛选过滤数据
效果:
VBA:
- Public Sub ButtunClick(sender As Object,e As SpreadsheetGear.Windows.Controls.ShapeActionEventArgs)
- Activeworkbook.WorkbookSet.GetLock()
- If String.Equals(e.Shape.Name,"Button 1") = True Then
- If ActiveWorkbook.Activeworksheet.AutoFilterMode = False Then
- Range("B5:K5").AutoFilter(Field:=2,Criteria1:=">=" & Range("D4").Value, Op:=1,Criteria2:="<=" & Range("E4").Value,visibleDropDown:=True)
- Else
- Range("B5:K5").AutoFilter
- End If
- End If
- Activeworkbook.WorkbookSet.ReleaseLock()
- End Sub'按钮/标签点击事件
复制代码
|
|
hessen