PDA

View Full Version : Filter not work with xl2007?



Pinokkio
04-22-2010, 10:42 AM
Can anyone tell me why this macro does not work in xl2007?

Any help appreciated,

P.

lucas
04-22-2010, 11:12 AM
Which one?

lucas
04-22-2010, 11:42 AM
Is this the one?

Sub RemoveFilter()
On Error Resume Next
Worksheets("HISGEN_OCT_20060101-20060731").Cells.EntireRow.Hidden = False
' ActiveSheet.ShowAllData
End Sub

Pinokkio
04-22-2010, 11:53 AM
Sorry,




Sub Test()
Dim TmpVal As String
Dim TmpCol As String
Dim TmpRng As Range


Application.ScreenUpdating = False
' removes previous "filter".
Cells.EntireRow.Hidden = False

' asks for value
TmpVal = InputBox("Enter the value you want to filter for.", "Filter Criteria")
' asks for column to filter
TmpCol = InputBox("Enter the column to filter on.", "Column Selection")
' hides each row that does not contain a match in the specified column
For Each TmpRng In Worksheets(1).UsedRange.Rows
If TmpRng.Range(TmpCol & "1").Value <> TmpVal And TmpRng.Row <> 1 Then
TmpRng.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub



Get an ERROR 1004 on line :
If TmpRng.Range(TmpCol & "1").Value <> TmpVal And TmpRng.Row <> 1 Then