{"id":2893,"date":"2019-12-17T22:20:27","date_gmt":"2019-12-17T13:20:27","guid":{"rendered":"https:\/\/okamurax.com\/?p=2893"},"modified":"2021-07-29T04:57:36","modified_gmt":"2021-07-28T19:57:36","slug":"vba-%e9%87%8d%e8%a4%87%e5%89%8a%e9%99%a4","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=2893","title":{"rendered":"VBA \u91cd\u8907\u524a\u9664"},"content":{"rendered":"<p>\u91cd\u8907\u3092\u53d6\u308a\u9664\u304f\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308b\u3068\u601d\u3046\u3051\u3069\u3001\u30cd\u30c3\u30c8\u4e0a\u3067\u4e00\u756a\u6709\u540d\u306adictionary\u3092\u4f7f\u3046\u65b9\u6cd5\u3092\u63a1\u7528\u3002<\/p>\n<pre class=\"lang:vb decode:true\">Sub DeleteDuplicate()\r\n\r\nSet dic = CreateObject(\"scripting.dictionary\")\r\n\r\nFor Each r In Selection\r\n  If Not dic.exists(r.Value) Then dic.Add r.Value, \"\"\r\nNext\r\n\r\nk = dic.keys\r\nFor i = 0 To dic.Count - 1\r\n  Sheets(\"Sheet2\").Cells(i + 1, 1).Value = k(i)\r\nNext i\r\n\r\nEnd Sub\r\n<\/pre>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/WEq9O68DLbk\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u5c11\u3057\u9055\u3046\u30d0\u30fc\u30b8\u30e7\u30f3<\/p>\n<pre class=\"lang:vb decode:true \">Sub DeleteDuplicate()\r\n \r\nSet dic = CreateObject(\"scripting.dictionary\")\r\n\r\nSet w = ActiveSheet\r\n\r\nFor r = 2 To 4111\r\n\r\n  k = w.Cells(r, 1).Value\r\n  v = w.Cells(r, 2).Value\r\n\r\n  If Not dic.exists(k) Then dic.Add k, v\r\n  \r\nNext\r\n\r\nkk = dic.keys\r\nvv = dic.items\r\n\r\nFor i = 0 To dic.Count - 1\r\n  w.Cells(i + 1, 4).Value = kk(i)\r\n  w.Cells(i + 1, 5).Value = vv(i)\r\nNext i\r\n \r\nEnd Sub<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u91cd\u8907\u3092\u53d6\u308a\u9664\u304f\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308b\u3068\u601d\u3046\u3051\u3069\u3001\u30cd\u30c3\u30c8\u4e0a\u3067\u4e00\u756a\u6709\u540d\u306adictionary\u3092\u4f7f\u3046\u65b9\u6cd5\u3092\u63a1\u7528\u3002 Sub DeleteDuplicate() Set dic = CreateObject(&#8220;scripting.di &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=2893\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;VBA \u91cd\u8907\u524a\u9664&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5],"class_list":["post-2893","post","type-post","status-publish","format-standard","hentry","category-1","tag-vba"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2893"}],"version-history":[{"count":5,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2893\/revisions"}],"predecessor-version":[{"id":4439,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2893\/revisions\/4439"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}