View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Hilvert Scheper Hilvert Scheper is offline
external usenet poster
 
Posts: 31
Default AutoFilter Criteria in VBA

Dear Jacob and Per,
Thank You so much for Your ideas BUT...
The Filter still does not show anything; "0 Records of 1416 found", where it
should show 225 records...
Sorry!!
Any ideas Please?
Rgds, Hilvert


"Per Jessen" wrote:

Hi

You are trying to filter for the text "'[Other File...." , not for the value
in A3. Look at this:

Set wb = Workbooks("Other File.xls")
Set sh = wb.Worksheets("Sheet1")
Crit1 = sh.Range("A3").Value
Crit2 = sh.Range("A9").Value
Selection.AutoFilter Field:=4, Criteria1:= _
"" & Crit1, _
Operator:=xlAnd
Selection.AutoFilter Field:=4, Criteria1:= _
"<=" & Crit2, _
Operator:=xlAnd

Hopes this helps.
---
Per

"Hilvert Scheper" skrev i
meddelelsen ...
Hi There,
Can Anyone help me out here Please,
I want to Filter a spreadsheet by Two criteria that refer to values in
another workbook: Greater than the Date in Cell A3 and Less than the Date
in
Cell A9.
How on earth can I do this? I tried:

Selection.AutoFilter Field:=4, Criteria1:= _
"'[Other File.xls]Sheet1'!$A$3", _
Operator:=xlAnd
Selection.AutoFilter Field:=4, Criteria1:= _
"<='[Other File.xls]Sheet1'!$A$9", _
Operator:=xlAnd

and this doesn't work. The Filter is on but isn't showing Any entries...
I Really appreciate Your help!!
Rgds, Hilvert