close

This one has me puzzled...

In previous macros I've used this code if I wanted the criteria value
to = a value in a cell somewhere else.

Sheets(quot;Data 1quot;).Select
Selection.AutoFilter Field:=7, Criteria1:=Sheets(quot;Reportquot;).Range(quot;A1quot;),
Operator:=xlAnd

In this case for example, cell A1 in Report worksheet has a value of
quot;testquot;. So in the Data 1 worksheet, it would find all rows with quot;testquot;
in Column G (pretty simple).

I seem to be having difficulty using the same method above when
instead of using a word like quot;testquot;, I'm using a date, like 12/11/05 in
my Report worksheet, cell A1. There are plenty of dates with 12/11/05
in the Data 1 sheet so I'm puzzled.

I've double checked the format of the cell in A1 to make sure it's the
same format as the dates in Column G in Data 1 and everthing is in
synch.

Any ideas?Try

Sheets(quot;Data 1quot;).AutoFilter Field:=7,
Criteria1:=Sheets(quot;Reportquot;).Range(quot;A1quot;).Text, Operator:=xlAnd--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

gt; wrote in message ps.com...
gt;
gt; This one has me puzzled...
gt;
gt; In previous macros I've used this code if I wanted the criteria value
gt; to = a value in a cell somewhere else.
gt;
gt; Sheets(quot;Data 1quot;).Select
gt; Selection.AutoFilter Field:=7, Criteria1:=Sheets(quot;Reportquot;).Range(quot;A1quot;),
gt; Operator:=xlAnd
gt;
gt; In this case for example, cell A1 in Report worksheet has a value of
gt; quot;testquot;. So in the Data 1 worksheet, it would find all rows with quot;testquot;
gt; in Column G (pretty simple).
gt;
gt; I seem to be having difficulty using the same method above when
gt; instead of using a word like quot;testquot;, I'm using a date, like 12/11/05 in
gt; my Report worksheet, cell A1. There are plenty of dates with 12/11/05
gt; in the Data 1 sheet so I'm puzzled.
gt;
gt; I've double checked the format of the cell in A1 to make sure it's the
gt; same format as the dates in Column G in Data 1 and everthing is in
gt; synch.
gt;
gt; Any ideas?
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()