﻿{"id":3848,"date":"2013-09-22T22:00:56","date_gmt":"2013-09-22T13:00:56","guid":{"rendered":"http:\/\/fujiitoshiki.com\/improvesociety\/?p=3848"},"modified":"2017-04-27T16:06:19","modified_gmt":"2017-04-27T07:06:19","slug":"post-3848","status":"publish","type":"post","link":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=3848","title":{"rendered":"EXCEL VBA\u30672\u3064\u306e1\u6b21\u5143\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u8abf\u3079\uff0c\u914d\u5217\u306e\u5dee\u5206\u3092\u6c42\u3081\u308b"},"content":{"rendered":"<div class=\"theContentWrap-ccc\"><p>\u3000EXCEL VBA \u306b\u304a\u3044\u3066\uff0c2 \u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u5426\u304b\u8abf\u3079\u305f\u3044\u3053\u3068\u306f\u3088\u304f\u3042\u308a\u307e\u3059\uff0e\u66f4\u306b2\u3064\u306e\u914d\u5217\u306e\u5dee\u5206\uff0c\u3064\u307e\u308a\u4e92\u3044\u306b\u91cd\u8907\u3057\u306a\u3044\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\u3068\u3044\u3046\u9700\u8981\u3082\u3042\u308a\u307e\u3059\uff0e\u4eca\u56de\u306f\u914d\u5217\u306e\u5dee\u5206\u3092\u6c42\u3081\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff0e<\/p>\n<p>\u30002\u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u3092\u307e\u305a\u8abf\u3079\uff0c\u7b49\u3057\u304f\u306a\u3044\u5834\u5408\u306b\u6b21\u306b\u4e00\u65b9\u304c\u4ed6\u65b9\u306e\u771f\u90e8\u5206\u96c6\u5408\u3067\u3042\u308b\u304b\u5426\u304b\u3092\u8abf\u3079\u307e\u3059\uff0e\u6700\u5f8c\u306b\u914d\u5217\u306e\u5dee\u5206\u3092\u6c42\u3081\u307e\u3059\uff0e\u3053\u306e\u9806\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u306f\u5168\u304f\u540c\u30582\u3064\u306e\u914d\u5217\u306e\u5dee\u5206\u306f\u7a7a\u96c6\u5408\u3068\u306a\u3063\u3066\u89e3\u304c\u6c42\u307e\u3089\u306a\u3044\u305f\u3081\u3067\u3042\u308a\uff0c\u5f15\u304d\u7b97\u3055\u308c\u308b\u914d\u5217\u304c\u5f15\u304d\u7b97\u3059\u308b\u914d\u5217\u306e\u771f\u90e8\u5206\u96c6\u5408\u306e\u5834\u5408\u306b\u3082\u7d50\u679c\u304c\u7a7a\u96c6\u5408\u3068\u306a\u308a\u89e3\u304c\u6c42\u307e\u3089\u306a\u3044\u305f\u3081\u3067\u3059\uff0e<\/p>\n<p><a href=\"\/\/fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/Array1Array2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/Array1Array2-300x200.png\" alt=\"Array1&amp;Array2\" width=\"300\" height=\"200\" class=\"alignnone size-medium wp-image-3850\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/Array1Array2-300x200.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/Array1Array2-100x66.png 100w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/Array1Array2.png 301w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/p>\n<p>\u3000Array1 \u306e\u914d\u5217\u8981\u7d20\u5168\u4f53\u3092 A, Array2 \u306e\u914d\u5217\u8981\u7d20\u5168\u4f53\u3092 B \u3068\u3059\u308b\u3068 Array1 \u304b\u3089 Array2 \u3092\u5dee\u3057\u5f15\u3044\u305f\u5dee\u5206\u306f\u4e0b\u5f0f\u3067\u8868\u73fe\u3055\u308c\u307e\u3059\uff0e<\/p>\n<p><img src='https:\/\/s0.wp.com\/latex.php?latex=Array1+-+Array2+%3D+A%5C+AND%5C+%28not+B%29+%3D+A+%5Ccap+%5Cneg+B&#038;bg=T&#038;fg=000000&#038;s=0' alt='Array1 - Array2 = A\\ AND\\ (not B) = A \\cap \\neg B' title='Array1 - Array2 = A\\ AND\\ (not B) = A \\cap \\neg B' class='latex' \/><\/p>\n<\/p>\n<p>\u3000\u4e8c\u91cd\u30eb\u30fc\u30d7\u306b\u3088\u308a\u305d\u308c\u305e\u308c\u306e\u8981\u7d20\u3092\u6bd4\u8f03\u3057\u3066\u4e00\u81f4\u3057\u305f\u6570\u3092\u6c42\u3081\u3066\u3044\u307e\u3059\u304c\uff0c\u3053\u308c\u306f\u7a4d\u96c6\u5408\u3092\u53d6\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u4ed6\u306a\u308a\u307e\u305b\u3093\uff0e<a href=\"\/\/fujiitoshiki.com\/improvesociety\/?p=3429\" target=\"_blank\">EXCEL\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u304a\u3044\u3066\u6570\u5f0f\u306e\u53c2\u7167\u5143\u306e\u6700\u521d\u306e\u30bb\u30eb\u304a\u3088\u3073\u53c2\u7167\u5148\u306e\u6700\u5f8c\u306e\u30bb\u30eb\u3092\u53d6\u5f97\u3059\u308b<\/a>\u3067\u3082\u8ff0\u3079\u307e\u3057\u305f\u304c\uff0c2\u3064\u306e\u96c6\u5408\u306e\u548c\u96c6\u5408\u3068\u7a4d\u96c6\u5408\u306e\u8981\u7d20\u6570\u304c\u7b49\u3057\u3051\u308c\u3070\u5143\u306e2\u3064\u306e\u96c6\u5408\u306f\u5168\u304f\u540c\u3058\u3067\u3059\uff0e\u3053\u3053\u3067\u306e\u30ed\u30b8\u30c3\u30af\u306f\u7a4d\u96c6\u5408\u306e\u8981\u7d20\u6570\u3068\u5143\u306e\u96c6\u5408\u306e\u8981\u7d20\u6570\u304c\u7b49\u3057\u3051\u308c\u3070\u5143\u306e2\u3064\u306e\u96c6\u5408\u306f\u7b49\u3057\u3044\u7b48\u3067\u3042\u308b\u3068\u306e\u524d\u63d0\u306b\u7acb\u3063\u3066\u3044\u307e\u3059\uff0e<\/p>\n<pre class=\"toolbar-overlay:true lang:vb decode:true\">Option Explicit\r\n\r\nFunction COMPARE_ARRAY(ByRef Array1() As String, ByRef Array2() As String) As Boolean\r\n    Dim i   As Long\r\n    Dim j   As Long\r\n    Dim k   As Long\r\n    k = 0\r\n    For i = LBound(Array1) To UBound(Array1)\r\n        For j = LBound(Array2) To UBound(Array2)\r\n            If Array1(i) = Array2(j) Then\r\n                k = k + 1\r\n            End If\r\n        Next j\r\n    Next i\r\n    If i = j And i = k Then\r\n        COMPARE_ARRAY = True\r\n    Else\r\n        COMPARE_ARRAY = False\r\n    End If\r\nEnd Function\r\n\r\nFunction PROPERSUBSET_ARRAY(ByRef Array1() As String, ByRef Array2() As String) As Boolean\r\n    Dim i   As Long\r\n    Dim j   As Long\r\n    Dim k   As Long\r\n    k = 0\r\n    For i = LBound(Array1) To UBound(Array1)\r\n        For j = LBound(Array2) To UBound(Array2)\r\n            If Array1(i) = Array2(j) Then\r\n                k = k + 1\r\n            End If\r\n        Next j\r\n    Next i\r\n    If k = i Then\r\n        PROPERSUBSET_ARRAY = True\r\n    Else\r\n        PROPERSUBSET_ARRAY = False\r\n    End If\r\nEnd Function\r\n<\/pre>\n<p>\u3000\u4e0b\u8a18\u95a2\u6570\u3067\u306f\u7b2c 3 \u5f15\u6570\u306e Compare \u306e\u6307\u5b9a\u306b\u3088\u308a Array1 \u304b\u3089 Array2 \u306e\u5dee\u5206\u3092\u6c42\u3081\u308b\u304b\uff0cArray2 \u304b\u3089 Array1 \u306e\u5dee\u5206\u3092\u6c42\u3081\u308b\u304b\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\uff0e\u4f46\u3057\uff0c\u914d\u5217\u5185\u306e\u8981\u7d20\u306b\u3082\u3068\u3082\u3068\u7a7a\u767d\u6587\u5b57\u5217\u304c\u3042\u3063\u305f\u5834\u5408\u306b\u306f\u3046\u307e\u304f\u52d5\u4f5c\u3057\u307e\u305b\u3093\uff0e<\/p>\n<pre class=\"toolbar-overlay:true lang:vb decode:true\">\r\nFunction EXCEPT_ARRAY(ByRef Array1() As String, ByRef Array2() As String, ByVal Compare As Boolean) As String()\r\n    Dim i               As Long\r\n    Dim j               As Long\r\n    Dim k               As Long\r\n    Dim InternalAr1()   As String\r\n    Dim InternalAr2()   As String\r\n    Dim Ar1Ar()         As String\r\n    Dim Ar2Ar()         As String\r\n    InternalAr1 = Array1\r\n    InternalAr2 = Array2\r\n    For i = LBound(InternalAr1) To UBound(InternalAr1)\r\n        For j = LBound(InternalAr2) To UBound(InternalAr2)\r\n            If InternalAr1(i) = InternalAr2(j) Then\r\n                InternalAr1(i) = \"\"\r\n                InternalAr2(j) = \"\"\r\n                k = k + 1\r\n            End If\r\n        Next j\r\n    Next i\r\n    k = 0\r\n    For i = LBound(InternalAr1) To UBound(InternalAr1)\r\n        If InternalAr1(i) = \"\" Then\r\n        Else\r\n            ReDim Preserve Ar1Ar(k)\r\n            Ar1Ar(k) = InternalAr1(i)\r\n            k = k + 1\r\n        End If\r\n    Next i\r\n    k = 0\r\n    For j = LBound(InternalAr2) To UBound(InternalAr2)\r\n        If InternalAr2(j) = \"\" Then\r\n        Else\r\n            ReDim Preserve Ar2Ar(k)\r\n            Ar2Ar(k) = InternalAr2(j)\r\n            k = k + 1\r\n        End If\r\n    Next j\r\n    If Compare Then\r\n        EXCEPT_ARRAY = Ar1Ar\r\n    Else\r\n        EXCEPT_ARRAY = Ar2Ar\r\n    End If\r\nEnd Function\r\n<\/pre>\n<p>\u53c2\u7167\uff1a<br \/>\n<a href=\"\/\/fujiitoshiki.com\/improvesociety\/?p=3429\" target=\"_blank\">EXCEL\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u304a\u3044\u3066\u6570\u5f0f\u306e\u53c2\u7167\u5143\u306e\u6700\u521d\u306e\u30bb\u30eb\u304a\u3088\u3073\u53c2\u7167\u5148\u306e\u6700\u5f8c\u306e\u30bb\u30eb\u3092\u53d6\u5f97\u3059\u308b<\/a><\/p>\n<p><iframe src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=fujiitoshiki-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=479736761X\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u3000EXCEL VBA \u306b\u304a\u3044\u3066\uff0c2 \u3064\u306e\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u5426\u304b\u8abf\u3079\u305f\u3044\u3053\u3068\u306f\u3088\u304f\u3042\u308a\u307e\u3059\uff0e\u66f4\u306b2\u3064\u306e\u914d\u5217\u306e\u5dee\u5206\uff0c\u3064\u307e\u308a\u4e92\u3044\u306b\u91cd\u8907\u3057\u306a\u3044\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\u3068\u3044\u3046\u9700\u8981\u3082\u3042\u308a\u307e\u3059\uff0e\u4eca\u56de\u306f\u914d\u5217\u306e\u5dee\u5206\u3092\u6c42\u3081\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff0e \u30002 &hellip; <a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=3848\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;EXCEL VBA\u30672\u3064\u306e1\u6b21\u5143\u914d\u5217\u304c\u7b49\u3057\u3044\u304b\u8abf\u3079\uff0c\u914d\u5217\u306e\u5dee\u5206\u3092\u6c42\u3081\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6026,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[603,153,312,311,314,313,310],"class_list":["post-3848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","tag-excel","tag-vba","tag-312","tag-311","tag-314","tag-313","tag-310"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/3848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3848"}],"version-history":[{"count":23,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions"}],"predecessor-version":[{"id":3875,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions\/3875"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/media\/6026"}],"wp:attachment":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}