▽1
●
きゃづみぃ ●300ポイント ベストアンサー |
http://officetanaka.net/excel/vba/tips/tips151.htm
指定できるのは
xlFilterToday 1 今日
xlFilterYesterday 2 昨日
xlFilterTomorrow 3 明日
xlFilterThisWeek 4 今週
xlFilterLastWeek 5 先週
xlFilterNextWeek 6 来週
xlFilterThisMonth 7 今月
xlFilterLastMonth 8 先月
xlFilterNextMonth 9 来月
xlFilterThisQuarter 10 今四半期
xlFilterLastQuarter 11 前四半期
xlFilterNextQuarter 12 来四半期
xlFilterThisYear 13 今年
xlFilterLastYear 14 昨年
xlFilterNextYear 15 来年
xlFilterYearToDate 16 今年の初めから今日まで
xlFilterAllDatesInPeriodQuarter1 17 期間内の全日付:第1四半期
xlFilterAllDatesInPeriodQuarter2 18 期間内の全日付:第2四半期
xlFilterAllDatesInPeriodQuarter3 19 期間内の全日付:第3四半期
xlFilterAllDatesInPeriodQuarter4 20 期間内の全日付:第4四半期
xlFilterAllDatesInPeriodJanuary 21 期間内の全日付:1月
xlFilterAllDatesInPeriodFebruray 22 期間内の全日付:2月
xlFilterAllDatesInPeriodMarch 23 期間内の全日付:3月
xlFilterAllDatesInPeriodApril 24 期間内の全日付:4月
xlFilterAllDatesInPeriodMay 25 期間内の全日付:5月
xlFilterAllDatesInPeriodJune 26 期間内の全日付:6月
xlFilterAllDatesInPeriodJuly 27 期間内の全日付:7月
xlFilterAllDatesInPeriodAugust 28 期間内の全日付:8月
xlFilterAllDatesInPeriodSeptember 29 期間内の全日付:9月
xlFilterAllDatesInPeriodOctober 30 期間内の全日付:10月
xlFilterAllDatesInPeriodNovember 31 期間内の全日付:11月
xlFilterAllDatesInPeriodDecember 32 期間内の全日付:12月
しかありません。
それ以外は 以下のように 日付を指定してやるしかないです。
Selection.AutoFilter Field:=3, Criteria1:=">=" & DateSerial(Year(Date), Month(Date) - 2, 1), Operator:=xlAnd, _
Criteria2:="<=" & DateSerial(Year(Date), Month(Date) - 1, 0)
これで 先々月分が取得できます。