Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filters Property - Variable is empty

Status
Not open for further replies.

CopperWire

Technical User
Jun 25, 2003
47
US
I'm trying to filter a list based on a value picked on a form. When I execute the following code, I get an empty value for my h2 field. Any suggestions as to why this may be. I was populating that h2 value using a lookup, however, I even tried to hardcode it and I still get and empty value. My code is below!

Sub Filter()
'
'
With Worksheets("data")
If .AutoFilterMode Then
With .AutoFilter.Filters(1)
If .On Then h2 = .Criteria1
End With
End If
End With

End Sub
 
Nothing wrong with the code - just tested it and it works fine - h2 gets assigned whatever the data has been filtered on

However, you state that your aim is to filter a list - this code will just return what the list is CURRENTLY filtered for - please be more specific as to your goal here

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top