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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using "AND" operator in EXCEL function

Status
Not open for further replies.

grierfield

Technical User
Dec 18, 2002
55
US




I am trying to select the “VRE” within the dates Below – but I cant get the “AND” operator to work - HELP

Private Sub CommandButton1_Click()
With ActiveSheet
If Not .AutoFilterMode Then .[H2].AutoFilter

Range("H2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=6, Criteria1:=">12/31/2008" AND
Selection.AutoFilter Field:=6, Criteria1:="<=12/31/2009"
Selection.AutoFilter Field:=8, Criteria1:="VRE"

End With

End Sub
 



Dates are not strings.

Dates are NUMBERS. You must CONVERT your string to a REAL DATE. faq68-5827

Use the DateValue or DateSerial fucntion.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Still having trouble - could you show an example? thanks
 
Why not do it manually with the macrorecorder on ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PVH writes - Why not do it manually with the macrorecorder on ?


Mnnnnnnnn----- how does one record a macro and then get the "AND" operator in there?
 


how does one record a macro and then get the "AND" operator in there?
Select an AutoFilter with more than one criteria.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top