{"id":993,"date":"2015-03-26T13:28:58","date_gmt":"2015-03-26T04:28:58","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=993"},"modified":"2015-03-26T13:28:58","modified_gmt":"2015-03-26T04:28:58","slug":"iteration_foreach_next","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/iteration_foreach_next\/","title":{"rendered":"\u7e70\u308a\u8fd4\u3057\u51e6\u7406\uff08For Each\u2026Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff09"},"content":{"rendered":"<h2>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u3044\u65b9<\/h2>\n<div class=\"m30-l\">\n<br \/><\/p>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\u3011<\/strong><\/p>\n<p><strong>For Each<\/strong> <em>element<\/em> <strong>In<\/strong> <em>group<\/em><\/p>\n<p>\u3000\u3000[ <em>statements<\/em> ]<\/p>\n<p><strong>Next<\/strong> [ <em>element<\/em> ]<\/p>\n<\/div>\n<h3>\u3010\u9805\u76ee\u306e\u8aac\u660e\u3011<\/h3>\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>element&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3084\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u30e1\u30f3\u30d0\u30fb\u8981\u7d20\u3092\u53d7\u3051\u53d6\u308b\u305f\u3081\u306e\u5909\u6570\u3002\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u5834\u5408\u3001\u5f15\u6570 element \u306b\u306f\u7dcf\u79f0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u5909\u6570\u3001\u307e\u305f\u306f\u4efb\u610f\u306e\u56fa\u6709\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5909\u6570\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002\u914d\u5217\u306e\u5834\u5408\u306f\u3001\u30d0\u30ea\u30a2\u30f3\u30c8\u578b\u5909\u6570\u306e\u307f\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<li>group&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u540d\u307e\u305f\u306f\u914d\u5217\u540d\uff08\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u578b\u3092\u9664\u304f\uff09\u3002<\/li>\n<li>statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 group \u306e\u5404\u30e1\u30f3\u30d0\u30fb\u8981\u7d20\u306b\u5bfe\u3057\u3066\u5b9f\u884c\u3059\u308b\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<\/ul>\n<br \/><br \/>\n<p class=\"caution3\"><strong>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u304b\u3089\u629c\u3051\u51fa\u3059\u65b9\u6cd5\u306b\u3001<span class=\"red\"><strong>Exit For \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong><\/span> \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001<strong>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u306f\u30cd\u30b9\u30c8 (\u5165\u308c\u5b50) \u69cb\u9020\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u305d\u306e\u5834\u5408\u306b <strong>Exit For<\/strong> \u304c\u5b9f\u884c\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u305d\u306e <strong>Exit For<\/strong> \u3092\u56f2\u3093\u3067\u3044\u308b <strong>1 \u756a\u5185\u5074\u306e\u30eb\u30fc\u30d7<\/strong>\u304b\u3089\u629c\u3051\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p class=\"caution3\"><strong>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3084\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u30e1\u30f3\u30d0\u30fb\u8981\u7d20\u306b\u5bfe\u3057\u3066\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u3089\u3092<span class=\"red\"><strong>\u53d6\u308a\u51fa\u3059\u9806\u5e8f\u306b\u30eb\u30fc\u30eb\u306f\u3042\u308a\u307e\u305b\u3093<\/strong><\/span>\u3002\u3082\u3057\u305d\u306e\u9806\u756a\u304c\u91cd\u8981\u306a\u610f\u5473\u3092\u3082\u3064\u5834\u5408\u306b\u306f\u3001<strong>For&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u7b49\u3092\u5229\u7528\u3059\u308b\u65b9\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p class=\"caution7\">\u3082\u3057\u7121\u9650\u30eb\u30fc\u30d7\u306e\u72b6\u614b\u306b\u9665\u3063\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306f\u3001<span class=\"red\"><strong>[ECS] \u30ad\u30fc<\/strong><\/span>\u3092\u62bc\u3057\u7d9a\u3051\u308b\u304b\u3001\u305d\u308c\u3067\u623b\u3089\u306a\u3044\u5834\u5408\u306f\u3001<span class=\"red\"><strong>[Ctrl] + [Alt] + [Delete]<\/strong><\/span> \u3092\u62bc\u3057\u3066 Windows \u306e\u30bf\u30b9\u30af\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u8868\u793a\u3057\u3066\u3001Excel \u3092\u5f37\u5236\u7d42\u4e86\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/div>\n<br \/><br \/>\n<h2>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">VBA\u30bd\u30fc\u30b9\u4f8b<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"For Each...Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\n\r\nSub sample_foreach_next()\r\n\r\n    Dim Sht As Object\r\n    Dim ShtNames As String\r\n          \r\n    For Each Sht In Worksheets\r\n    \r\n        ShtNames = ShtNames & Sht.Name & Chr(13)\r\n        \r\n    Next\r\n    \r\n    MsgBox ShtNames\r\n    \r\nEnd Sub\r\n\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\/03\/foreach_next.jpg?ssl=1\" rel=\"lightbox[993]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/foreach_next.jpg?resize=154%2C214&#038;ssl=1\" alt=\"for each next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u4f8b\" width=\"154\" height=\"214\" class=\"alignnone size-full wp-image-999\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>For Each&#8230;Next \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u3044\u65b9 \u3010\u69cb\u6587\u3011 For &#8230; <\/p>\n","protected":false},"author":1,"featured_media":999,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":"\u30d6\u30ed\u30b0\u3092\u66f4\u65b0\u3057\u307e\u3057\u305f\u3002"},"categories":[48],"tags":[59,38,49,56],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/foreach_next.jpg?fit=154%2C214&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-g1","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/993"}],"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=993"}],"version-history":[{"count":6,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/993\/revisions"}],"predecessor-version":[{"id":1000,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/993\/revisions\/1000"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/999"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}