Rowland Hamilton
Active Member
- Joined
- Nov 13, 2009
- Messages
- 250
Folks:
Why can't I get any of these codes to work (I'm using Excel 2010)?:
Or this one?
Great if they worked because they are simple and it doesn't matter where the filter is in the worksheet.
Doesn't like "activeProject" but didn't work with "Active.Sheets" either
Now this did work, but how can I modify it to then turn off the filter? And why is it so much longer than the other ones?:
Thank you - Rowland
Why can't I get any of these codes to work (I'm using Excel 2010)?:
Code:
Sub AutoFilOff()
If ActiveProject.AutoFilter = True Then
ActiveProject.AutoFilter = False
End If
End Sub
Code:
Sub AutoFltrTgl()
ActiveProject.AutoFilter = Not ActiveProject.AutoFilter
End sub
Doesn't like "activeProject" but didn't work with "Active.Sheets" either
Now this did work, but how can I modify it to then turn off the filter? And why is it so much longer than the other ones?:
Code:
Sub Check_AutoFilter_IsPresent()
'Check if Sheet has AutoFilter
'Check if filter was applied to any column
Dim oWS As Worksheet ' Worksheet Object
On Error GoTo Disp_Error
oWS = ActiveSheet
If Not oWS.AutoFilter Is Nothing Then
If oWS.FilterMode = True Then
MsgBox ("Auto Filter On: Filter Mode On")
Else
MsgBox ("Auto Filter On: Filter Mode Off")
End If
Else
MsgBox ("Auto Filter Off")
End If
If Not oWS Is Nothing Then oWS = Nothing
' --------------------
' Error Handling
' --------------------
Disp_Error:
If Err <> 0 Then
MsgBox Err.Number & " - " & Err.Description, vbExclamation, "ERROR MESSAGE"
Resume Next
End If
End Sub