{"id":2439,"date":"2022-06-30T01:30:49","date_gmt":"2022-06-29T16:30:49","guid":{"rendered":"http:\/\/oreoreki.gotdns.ch\/?p=2439"},"modified":"2022-06-30T01:30:49","modified_gmt":"2022-06-29T16:30:49","slug":"post-2439","status":"publish","type":"post","link":"http:\/\/oreoreki.gotdns.ch\/?p=2439","title":{"rendered":"VBA100\u672c\u30ce\u30c3\u30af98-99\u30fb\u5e2d\u66ff\u3048\u30eb\u30fc\u30eb\u304c\u5b88\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u30fb\u5b9f\u884c"},"content":{"rendered":"<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"750\" height=\"422\" src=\"https:\/\/www.youtube.com\/embed\/YbpErlQPTvc?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=ja&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"750\" height=\"422\" src=\"https:\/\/www.youtube.com\/embed\/RU_R0Q3qU2Y?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=ja&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span><\/p>\n<div class=\"hcb_wrap\">\nVBA100\u672c\u30ce\u30c3\u30af 98\u672c\u76ee\uff1a\u5e2d\u66ff\u3048\u30eb\u30fc\u30eb\u304c\u5b88\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d<br \/>\nhttps:\/\/excel-ubara.com\/vba100\/VBA100_098.html<br \/>\nVBA100\u672c\u30ce\u30c3\u30af 99\u672c\u76ee\uff1a\u81ea\u52d5\u5e2d\u66ff\u3048\uff08\u884c\u5217\u3068\u524d\u5f8c\u5de6\u53f3\u304c\u5168\u3066\u9055\u3046\u3088\u3046\u306b\uff09<br \/>\nhttps:\/\/excel-ubara.com\/vba100\/VBA100_099.html<\/p>\n<p><span class=\"bold-red\">\u3053\u306e\u52d5\u753b\u306e\u30de\u30af\u30ed\u306fWindows11\/Office2013\u3067\u4f5c\u6210\u3057\u3066\u307e\u3059\u3002<br \/>\n<\/span><\/p>\n<h2><\/h2>\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>Sub \u5e2d\u66ff\u3048\u5b9f\u884c()\r\n    \r\n    '0\u59cb\u307e\u308a\u306a\u306e\u3067\u5b9f\u969b\u306e\u884c,ee\u5217\u6570-1\u3092\u8a2d\u5b9a\r\n    Const \u6700\u5927\u884c = 5    '\u7e26\u3000y\u8ef8\u65b9\u5411\r\n    Const \u6700\u5927\u5217 = 5    '\u6a2a\u3000x\u8ef8\u65b9\u5411\r\n    \r\n    \r\n    Set \u73fe\u5ea7\u5e2d\u5de6\u4e0a = ThisWorkbook.Sheets(\"\u5ea7\u5e2d\u8868\uff08\u73fe\uff09\").Range(\"b5\")\r\n    Set \u65b0\u5ea7\u5e2d\u5de6\u4e0a = ThisWorkbook.Sheets(\"\u5ea7\u5e2d\u8868\uff08\u73fe\uff09\").Range(\"b13\")\r\n    Set WK\u5ea7\u5e2d\u5de6\u4e0a = ThisWorkbook.Sheets(\"\u5ea7\u5e2d\u8868\uff08\u73fe\uff09\").Range(\"b22\")\r\n    \r\n    Range(\u65b0\u5ea7\u5e2d\u5de6\u4e0a, \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(\u6700\u5927\u884c, \u6700\u5927\u5217)).ClearContents\r\n    Range(WK\u5ea7\u5e2d\u5de6\u4e0a, WK\u5ea7\u5e2d\u5de6\u4e0a.Offset(\u6700\u5927\u884c, \u6700\u5927\u5217)).ClearContents\r\n    \r\n    'f(n) = (2n+1) mod (5+2)\r\n    '{0,1,2,3,4,5} -> {1,3,5,0,2,4}\u3000\u2190\u524d\u5f8c\u306e\u6570\u5b57\u306f\u5c11\u306a\u304f\u3068\u30822\u4ee5\u4e0a\u96e2\u308c\u308b\r\n    '\u6700\u5927\u884c\uff08\u5217\uff09\u6570\u304c\u5947\u6570\u306e\u3068\u304d\u306e\u307f\u3046\u307e\u304f\u3044\u304f\r\n  \r\n    '\u884c\u306b\u3064\u3044\u3066\u95a2\u6570f\u3067\u79fb\u52d5\r\n    For i = 0 To \u6700\u5927\u884c\r\n        Range(\u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(i, 0), \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(i, \u6700\u5927\u5217)).Copy Destination:=WK\u5ea7\u5e2d\u5de6\u4e0a.Offset((2 * i + 1) Mod (\u6700\u5927\u884c + 2), 0)\r\n    Next\r\n    \r\n    '\u5217\u306b\u3064\u3044\u3066\u95a2\u6570f\u3067\u79fb\u52d5\r\n    For i = 0 To \u6700\u5927\u5217\r\n        Range(WK\u5ea7\u5e2d\u5de6\u4e0a.Offset(0, i), WK\u5ea7\u5e2d\u5de6\u4e0a.Offset(\u6700\u5927\u884c, i)).Copy Destination:=\u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(0, (2 * i + 1) Mod (\u6700\u5927\u5217 + 2))\r\n    Next\r\n    \r\n    Range(WK\u5ea7\u5e2d\u5de6\u4e0a, WK\u5ea7\u5e2d\u5de6\u4e0a.Offset(\u6700\u5927\u884c, \u6700\u5927\u5217)).Clear\r\n    \r\n    Call \u5e2d\u66ff\u3048\u30c1\u30a7\u30c3\u30af\r\n    \r\nEnd Sub\r\n\r\n\r\nSub \u5e2d\u66ff\u3048\u30c1\u30a7\u30c3\u30af()\r\n    Dim f(5, 5)\r\n    \r\n    Set \u73fe\u5ea7\u5e2d\u5de6\u4e0a = ThisWorkbook.Sheets(\"\u5ea7\u5e2d\u8868\uff08\u73fe\uff09\").Range(\"b5\")\r\n    Set \u65b0\u5ea7\u5e2d\u5de6\u4e0a = ThisWorkbook.Sheets(\"\u5ea7\u5e2d\u8868\uff08\u73fe\uff09\").Range(\"b13\")\r\n   \r\n    For y = 0 To 5\r\n        For x = 0 To 5\r\n        '\u65b0\u3057\u3044\u5e2d\u3092\u898b\u3064\u3051\u308b\r\n        Set c = Range(\u65b0\u5ea7\u5e2d\u5de6\u4e0a, \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(5, 5)).Find(\u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value)\r\n        '\u65b0\u3057\u3044\u5e2d\u756a\u3092 \u5e2d\u756a\u914d\u5217\u306b\u3044\u308c\u308b\r\n        f(y, x) = Array(c.Row - \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Row, c.Column - \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Column)\r\n        Next\r\n    Next\r\n\r\n    '\u5ea7\u5e2d\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046\r\n    For y = 0 To 5\r\n        For x = 0 To 5\r\n            '\u524d\u3068\u540c\u3058\u884c\u5217\u304b\uff1f\r\n            If (y = f(y, x)(0)) Or (x = f(y, x)(1)) = True Then\r\n                Debug.Print \"\u884c\u5217\u304c\u540c\u3058:\" & \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value\r\n                \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(f(y, x)(0), f(y, x)(1)).Interior.ColorIndex = 6\r\n            End If\r\n\r\n            '\u4e0b\u306e\u4eba\u306e\u79fb\u8ee2\u5148\u3092\u30c1\u30a7\u30c3\u30af\r\n            If y <> 5 Then\r\n                '\u4e09\u5e73\u65b9\u306e\u5b9a\u7406\u3067f(y, x)\u3068f(y+1, x)\u3068\u306e\u8ddd\u96e2\u3092\u8abf\u3079\u308b\r\n                If (f(y, x)(0) - f(y + 1, x)(0)) ^ 2 + (f(y, x)(1) - f(y + 1, x)(1)) ^ 2 = 1 Then\r\n                    Debug.Print \"\u4e0b\u304c\u96a3:\" & \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value\r\n                    \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(f(y, x)(0), f(y, x)(1)).Interior.ColorIndex = 6\r\n                End If\r\n            End If\r\n            '\u4e0a\u306e\u4eba\u306e\u79fb\u8ee2\u5148\u3092\u30c1\u30a7\u30c3\u30af\r\n            If y <> 0 Then\r\n                '\u4e09\u5e73\u65b9\u306e\u5b9a\u7406\u3067f(y, x)\u3068f(y-1, x)\u3068\u306e\u8ddd\u96e2\u3092\u8abf\u3079\u308b\r\n                If (f(y, x)(0) - f(y - 1, x)(0)) ^ 2 + (f(y, x)(1) - f(y - 1, x)(1)) ^ 2 = 1 Then\r\n                    Debug.Print \"\u4e0a\u304c\u96a3:\" & \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value\r\n                    \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(f(y, x)(0), f(y, x)(1)).Interior.ColorIndex = 7\r\n                End If\r\n            End If\r\n            '\u53f3\u306e\u4eba\u306e\u79fb\u8ee2\u5148\u3092\u30c1\u30a7\u30c3\u30af\r\n            If x <> 0 Then\r\n                '\u4e09\u5e73\u65b9\u306e\u5b9a\u7406\u3067f(y, x)\u3068f(y, x-1)\u3068\u306e\u8ddd\u96e2\u3092\u8abf\u3079\u308b\r\n                If (f(y, x)(0) - f(y, x - 1)(0)) ^ 2 + (f(y, x)(1) - f(y, x - 1)(1)) ^ 2 = 1 Then\r\n                    Debug.Print \"\u53f3\u304c\u96a3:\" & \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value\r\n                    \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(f(y, x)(0), f(y, x)(1)).Interior.ColorIndex = 8\r\n                End If\r\n            End If\r\n            '\u5de6\u306e\u4eba\u306e\u79fb\u8ee2\u5148\u3092\u30c1\u30a7\u30c3\u30af\r\n            If x <> 5 Then\r\n                '\u4e09\u5e73\u65b9\u306e\u5b9a\u7406\u3067f(y, x)\u3068f(y, x+1)\u3068\u306e\u8ddd\u96e2\u3092\u8abf\u3079\u308b\r\n                If (f(y, x)(0) - f(y, x + 1)(0)) ^ 2 + (f(y, x)(1) - f(y, x + 1)(1)) ^ 2 = 1 Then\r\n                    Debug.Print \"\u5de6\u304c\u96a3:\" & \u73fe\u5ea7\u5e2d\u5de6\u4e0a.Offset(y, x).Value\r\n                    \u65b0\u5ea7\u5e2d\u5de6\u4e0a.Offset(f(y, x)(0), f(y, x)(1)).Interior.ColorIndex = 6\r\n                End If\r\n            End If\r\n        Next\r\n    Next\r\nEnd Sub\r\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>VBA100\u672c\u30ce\u30c3\u30af 98\u672c\u76ee\uff1a\u5e2d\u66ff\u3048\u30eb\u30fc\u30eb\u304c\u5b88\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d https:\/\/excel-uba [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2441,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[34],"tags":[],"class_list":["post-2439","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vba"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"http:\/\/oreoreki.gotdns.ch\/wp-content\/uploads\/sites\/2\/2022\/06\/vba10098-99.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9WqRX-Dl","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2439"}],"version-history":[{"count":1,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2439\/revisions"}],"predecessor-version":[{"id":2440,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2439\/revisions\/2440"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/media\/2441"}],"wp:attachment":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2439"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}