返回列表 上一主題 發帖

[發問] ★(發問)一個資料欄位不對稱的資料篩選問題

回復 29# GBKEE

給GBKEE大
經過檢查跟校正之後終於完成
這個是完成的檔案(2007到2011):

2007_2011總合.rar (377.87 KB)

TOP

本帖最後由 GBKEE 於 2012-1-8 13:24 編輯

回復 31# yagami12th
謝謝你

TOP

謝謝各位大大的熱心分享
stock

TOP

回復 22# yagami12th


    請教版大...
    無法篩選的問題,是換電腦之後就解決了嗎???
    在 excel2010 執行還是會有問題

    如附圖:

   謝謝!!

TOP

回復 20# GBKEE

google 一下autofilter 的用法
我好像找到一個解法:
            
       E.Range("A1").AutoFilter 1, Format(i, "yyyy/m/d")
   
改成這樣就可以跑了...
提供給大家參考...

擷取的說明:
http://www.pcreview.co.uk/forums/excel-can-use-variable-autofilter-vba-t3748818.html
======================
This is from "Excel 2002 VBA Programmer's Reference"
Written by John Green, Stephen Bullen, Rob Bovey and Robert Rosenberg

http://www.oaltd.co.uk:80/ExcelProgR...rogRefCh22.htm
Search for "Range.AutoFilter" and you'll see this note:

Range.AutoFilter

The AutoFilter method of a Range object is a very curious beast. We are forced
to pass it strings for its filter criteria and hence must be aware of its string
handling behaviour. The criteria string consists of an operator (=, >, <, >=
etc.) followed by a value.

If no operator is specified, the "=" operator is assumed. The key issue is that
when using the "=" operator, AutoFilter performs a textual match, while using
any other operator results in a match by value. This gives us problems when
trying to locate exact matches for dates and numbers.

If we use "=", Excel matches on the text that is displayed in the cell, i.e. the
formatted number. As the text displayed in a cell will change with different
regional settings and Windows language version, it is impossible for us to
create a criteria string that will locate an exact match in all locales.

There is a workaround for this problem. When using any of the other filter
criteria, Excel plays by the rules and interprets the criteria string according
to US formats. Hence, a search criterion of ">=02/01/2001" will find all dates
on or after 1st Feb, 2001, in all locales.

We can use this to match an exact date by using two AutoFilter criteria. The
following code will give an exact match on 1st Feb, 2001 and will work in any
locale:

Range("A1200").AutoFilter 2, ">=02/01/2001", xlAnd, "<=02/01/2001"

TOP

        靜思自在 : 滴水成河。粒米成蘿,勿輕己靈,勿以善小而不為。
返回列表 上一主題