{"id":3538,"date":"2015-09-10T08:00:29","date_gmt":"2015-09-09T23:00:29","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=3538"},"modified":"2016-07-18T09:25:57","modified_gmt":"2016-07-18T00:25:57","slug":"rangeautofilter5","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/rangeautofilter5\/","title":{"rendered":"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\uff08AutoFilterMode, FilterMode)"},"content":{"rendered":"<h2>AutoFilterMode \u30d7\u30ed\u30d1\u30c6\u30a3<\/h2>\n<div class=\"m30-l\">\n<p><strong>AutoFilterMode \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\uff08Worksheet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3092\u8abf\u3079\u308b\u3053\u3068\u3067\u3001\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u4e0a\u306b\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u3001\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u3001\uff11\u3064\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u4e0a\u306b\uff11\u3064\u3057\u304b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>AutoFilterMode<\/strong> = <em>boolean<\/em><\/p><\/div>\n<br \/>\n<h3>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Worksheet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>boolean&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<span class=\"red\"><strong>False<\/strong> \u306e\u307f\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><strong>False<\/strong> \u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u89e3\u9664\u3055\u308c\u307e\u3059\u3002\uff08\u203b <strong>True<\/strong> \u3092\u6307\u5b9a\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\uff09<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution4\"><strong>AutoFilter \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\uff08Worksheet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3067\u3082\u78ba\u8a8d\u53ef\u80fd\u3067\u3059\u3002\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001<strong>AutoFilter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3092\u8fd4\u3057\u307e\u3059\u3002\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u3001<strong>Nothing<\/strong> \u3092\u8fd4\u3057\u307e\u3059\u3002<br \/>\n      <strong>\u3010\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u4f8b\u3011<\/strong><br \/>\n      \u3000\u3000Dim myFilter As AutoFilter<br \/>\n      \u3000\u3000Set myFilter = Activesheet.AutoFilter<br \/>\n      \u3000\u3000If myFilter Is Nothing Then<br \/>\n      \u3000\u3000\u3000\u3000&#8217;\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306e\u51e6\u7406<br \/>\n      \u3000\u3000Else<br \/>\n      \u3000\u3000\u3000\u3000&#8217;\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306e\u51e6\u7406<br \/>\n      \u3000\u3000End If\n    <\/p>\n<\/p><\/div>\n<\/div>\n<br \/><br \/>\n<h2>FilterMode \u30d7\u30ed\u30d1\u30c6\u30a3<\/h2>\n<div class=\"m30-l\">\n<p><strong>FilterMode \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\uff08AutoFilter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3092\u8abf\u3079\u308b\u3053\u3068\u3067\u3001\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u4f55\u3089\u304b\u306e\u6761\u4ef6\u3067\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u8abf\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001Excel 2007 \u4ee5\u964d\u306e\u307f\u4f7f\u7528\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>FilterMode<\/strong><\/p><\/div>\n<br \/>\n<h3>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Worksheet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span> \u307e\u305f\u306f\u3001<span class=\"red\"><strong>AutoFilter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span> \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u3001<strong>True<\/strong> \u3092\u3001\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u306f\u3001<strong>False<\/strong> \u3092\u8fd4\u3057\u307e\u3059\u3002\u30d6\u30fc\u30eb\u578b\uff08Boolean\uff09\u306e\u5024\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u5024\u306e\u53d6\u5f97\u306e\u307f\u53ef\u80fd\u3067\u3059\u3002<\/li>\n<\/ul><\/div>\n<\/div>\n<br \/><br \/>\n<h2>\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u78ba\u8a8d FilterMode \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3057\u305f\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"FilterMode \u30d7\u30ed\u30d1\u30c6\u30a3 \u3092\u4f7f\u7528\u3057\u3066\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample05_1_AutoFilter()\r\n    \r\n    \r\n    Dim myFilter As AutoFilter\r\n    \r\n    Set myFilter = ActiveSheet.AutoFilter\r\n\r\n    '\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\r\n    If Not myFilter Is Nothing Then\r\n    \r\n        '\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306e\u78ba\u8a8d\r\n        If ActiveSheet.AutoFilter.FilterMode Then\r\n            MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u3001\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u307e\u3059\"\r\n        Else\r\n            MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u3001\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u307e\u305b\u3093\"\r\n        End If\r\n\r\n    Else\r\n    \r\n        MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\"\r\n        Exit Sub\r\n    \r\n    End If\r\n    \r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01.jpg?ssl=1\" rel=\"lightbox[3538]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01.jpg?resize=580%2C360&#038;ssl=1\" alt=\"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d \u4f7f\u7528\u4f8b\uff11\" width=\"580\" height=\"360\" class=\"alignnone size-large wp-image-3541\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01.jpg?resize=580%2C360&amp;ssl=1 580w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01.jpg?resize=400%2C248&amp;ssl=1 400w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01.jpg?w=827&amp;ssl=1 827w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n<h2>Filter.On \u30d7\u30ed\u30d1\u30c6\u30a3<\/h2>\n<div class=\"m30-l\">\n<p><strong>FilterMode \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u306f\u3001Excel 2007 \u4ee5\u964d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3057\u304b\u4f7f\u7528\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u305d\u308c\u307e\u3067\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u5224\u5b9a\u3059\u308b\u306b\u306f\u3001\u5404\u5217\u3054\u3068\u306b\u7d5e\u308a\u8fbc\u307f\u304c\u884c\u308f\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u305d\u308c\u3092\u884c\u3046\u306b\u306f\u3001<strong>Filters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong> \u304b\u3089\u5404\u5217\u306e <strong>Filter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u3092\u53d6\u5f97\u3057\u3001On \u30d7\u30ed\u30d1\u30c6\u30a3\uff08<strong>Filters.Item(<em>index<\/em>).On<\/strong>\uff09\u306e\u5024\uff08\u30d6\u30fc\u30eb\u578b\uff09\u3092\u8abf\u3079\u307e\u3059\u3002\u305d\u306e\u5217\u304c\u7d5e\u308a\u8fbc\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u3001<strong>True<\/strong> \u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\">\uff1c\u5404\u5217\u306e\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u308b\u304b\u3092\u53d6\u5f97\uff1e<\/span><br \/>\n    <em>object<\/em>.<strong>Filters<\/strong>[ .<strong>Item<\/strong> ](<em>index<\/em>).<strong>On<\/strong><\/p>\n<p>    <span class=\"red\">\uff1c\u5217\u6570\u3092\u53d6\u5f97\uff1e<\/span><br \/>\n    <em>object<\/em>.<strong>Filters<\/strong>.<strong>Count<\/strong><\/p><\/div>\n<br \/>\n<h3>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Worksheet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>index&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u9577\u6574\u6570\u578b\uff08Long\uff09\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u3064\u307e\u308a\u3001\u5404\u5217\u3092\u8868\u3057\u307e\u3059\uff09\u3002<\/li>\n<\/ul><\/div>\n<\/div>\n<br \/><br \/>\n<h2>\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u78ba\u8a8d Filter.On \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3057\u305f\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Filter.On \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u3063\u3066\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample05_2_AutoFilter()\r\n    \r\n    Dim flg As Boolean, i As Long, str As String\r\n    \r\n    flg = False\r\n    \r\n    '\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\r\n    If ActiveSheet.AutoFilterMode Then\r\n    \r\n        For i = 1 To ActiveSheet.AutoFilter.Filters.Count\r\n            \r\n            '\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u304c\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u3001flg \u3092 True\r\n            If ActiveSheet.AutoFilter.Filters.Item(i).On Then\r\n                flg = True\r\n                str = str & i & \"\u5217\u76ee \"\r\n            End If\r\n        \r\n        Next i\r\n    \r\n    Else\r\n        MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\"\r\n        Exit Sub\r\n    End If\r\n    \r\n    If flg Then\r\n        MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u3001\" & str & \"\u3067\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u307e\u3059\"\r\n    Else\r\n        MsgBox \"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306f\u7d5e\u308a\u3053\u307e\u308c\u3066\u3044\u307e\u305b\u3093\"\r\n    End If\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_02.jpg?ssl=1\" rel=\"lightbox[3538]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_02.jpg?resize=580%2C360&#038;ssl=1\" alt=\"\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d \u4f7f\u7528\u4f8b\uff12\" width=\"580\" height=\"360\" class=\"alignnone size-large wp-image-3542\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_02.jpg?resize=580%2C360&amp;ssl=1 580w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_02.jpg?resize=400%2C248&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_02.jpg?w=827&amp;ssl=1 827w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>AutoFilterMode \u30d7\u30ed\u30d1\u30c6\u30a3 AutoFilterMode \u30d7\u30ed\u30d1\u30c6 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3639,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[268],"tags":[547,548,63,311,38,269],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/autofilter05_01-580x3601.jpg?fit=580%2C360&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-V4","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3538"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=3538"}],"version-history":[{"count":7,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3538\/revisions"}],"predecessor-version":[{"id":5628,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3538\/revisions\/5628"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/3639"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=3538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=3538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=3538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}