{"id":937,"date":"2015-03-23T21:30:00","date_gmt":"2015-03-23T12:30:00","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=937"},"modified":"2015-03-23T21:30:00","modified_gmt":"2015-03-23T12:30:00","slug":"conditional_branch_select","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/conditional_branch_select\/","title":{"rendered":"\u6761\u4ef6\u5206\u5c90\uff08Select Case \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff09"},"content":{"rendered":"<h2>Select Case \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>Select Case<\/strong> <em>form<\/em><\/p>\n<p>\u3000\u3000[ <strong>Case<\/strong> <em>value1<\/em><br \/>\n\u3000\u3000\u3000\u3000[ <em>statements1<\/em> ] ]<\/p>\n<p>\u3000\u3000[ <strong>Case<\/strong> <em>value2<\/em><br \/>\n\u3000\u3000\u3000\u3000[ <em>statements2<\/em> ] ]<\/p>\n<p>\u3000\u3000[ \u30fb\u30fb\u30fb\u30fb\u30fb ]<\/p>\n<p>\u3000\u3000[ <strong>Case Default<\/strong><br \/>\n\u3000\u3000\u3000\u3000[ <em>default_statements<\/em> ] ]<\/p>\n<p>\u3000\u3000[ <strong>Case Else<\/strong><br \/>\n\u3000\u3000\u3000\u3000[ <em>else_statements<\/em> ] ]<\/p>\n<p><strong>End Select<\/strong><\/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>form&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u6761\u4ef6\u5f0f\uff08\u6570\u5f0f\u307e\u305f\u306f\u6587\u5b57\u5217\u5f0f\uff09<\/li>\n<li>value1(2)&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u6b21\u306e\u5f62\u5f0f\u3067\u6307\u5b9a\uff08\u7701\u7565\u53ef\u3002\u305f\u3060\u3057Case\u7bc0\u304c\u3042\u308b\u5834\u5408\u306f\u5fc5\u9808\uff09<br \/>\n(1)\u3010\u5024\u3011<br \/>\n(2)\u3010\u5024\u3011<strong>To<\/strong>\u3010\u5024\u3011<br \/>\n(3)\u3000<strong>Is<\/strong>\u3010\u6bd4\u8f03\u6f14\u7b97\u5b50\u3011\u3010\u5024\u3011<\/li>\n<li>statements1(2)&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<em>form<\/em> \u304c <em>value1(2) \u3068\u4e00\u81f4\u3057\u305f\u3068\u304d <em>statements1(2)<\/em> \u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/em><\/li>\n<li>default_statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<em>form<\/em> \u304c Empty\u5024\uff08\u521d\u671f\u5316\u3055\u308c\u3066\u3044\u306a\u3044\u5024\uff09\u306e\u3068\u304d\u3001<em>default_statements<\/em> \u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<li>else_statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<em>form<\/em> \u304c Case \u7bc0\u306e\u3044\u305a\u308c\u3068\u3082\u4e00\u81f4\u3057\u306a\u3044\u3068\u304d <em>else_statements<\/em> \u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<\/ul>\n<br \/><br \/>\n<p class=\"caution3\">\n\u30ad\u30fc\u30ef\u30fc\u30c9 <strong>To<\/strong> \u3068 <strong>Is<\/strong> \u306f\u3001\u5024\u306e\u7bc4\u56f2\u3092\u6307\u5b9a\u3059\u308b\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u3059\u3002<br \/>\n\u203b \u3053\u306e <strong>Is<\/strong> \u306f\u3001\u6bd4\u8f03\u6f14\u7b97\u5b50\u306e Is \u3068\u306f\u5225\u7269\u3067\u3059\u3002<\/p>\n<p class=\"caution3\">\n<strong>To<\/strong> \u3092\u4f7f\u3063\u3066\u5024\u306e\u7bc4\u56f2\u3092\u6307\u5b9a\u3059\u308b\u3068\u304d\u306f\u3001\u5c0f\u3055\u3044\u65b9\u306e\u5024\u3092\u5148\uff08\u5de6\u5074\uff09\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p class=\"caution3\">\n\u3053\u3053\u3067\u4f7f\u7528\u3067\u304d\u308b\u6bd4\u8f03\u6f14\u7b97\u5b50\u306e\u7a2e\u985e\u306b\u306f\u3001\u3088\u308a\u5c0f\u3055\u3044\uff08<\uff09\u3001\u4ee5\u4e0b\uff08<=\uff09\u3001\u3088\u308a\u5927\u304d\u3044\uff08>\uff09\u3001\u4ee5\u4e0a\uff08>=\uff09\u3001\u7b49\u3057\u304f\u306a\u3044\uff08<>\uff09\u3001\u7b49\u3057\u3044\uff08=\uff09 \u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u7b49\u4fa1\u6f14\u7b97\u5b50\uff08Is\uff09\u3068\u6587\u5b57\u5217\u6bd4\u8f03\u6f14\u7b97\u5b50\uff08Like\uff09\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p class=\"caution3\">\nCase \u7bc0\u306b\u306f\u8907\u6570\u306e\u5f0f\u3084\u7bc4\u56f2\u3092\u6307\u5b9a\u53ef\u80fd\u3002\u305d\u306e\u5834\u5408\u306f\u30ab\u30f3\u30de\uff08,\uff09\u3067\u533a\u5207\u308a\u307e\u3059\u3002<br \/>\n\uff08\u4f8b\uff09Case 1 To 10, 23, Is > 100 <\/p>\n<\/div>\n<br \/><br \/>\n<h2>Select Case \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3>VBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Select Case \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub sample_select()\r\n    \r\n    Dim form As Integer\r\n    \r\n    form = -100\r\n    \r\n    Select Case form\r\n        \r\n        Case Default\r\n            MsgBox 1000\r\n    \r\n        Case 1, 2\r\n            MsgBox form\r\n        \r\n        Case 3 To 10\r\n            MsgBox form\r\n            \r\n        Case Is > 10\r\n            MsgBox form\r\n                    \r\n        Case Else\r\n            MsgBox form\r\n    \r\n    End Select\r\n\r\nEnd Sub\r\n\r\n\u3000\r\n<\/pre>\n<br \/>\n<h3>\u30bd\u30fc\u30b9\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/select01.jpg?ssl=1\" rel=\"lightbox[937]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/select01.jpg?resize=400%2C336&#038;ssl=1\" alt=\"select case \u6587 \u4f8b\" width=\"400\" height=\"336\" class=\"alignnone size-medium wp-image-949\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/select01.jpg?resize=400%2C336&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/select01.jpg?w=449&amp;ssl=1 449w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-recalc-dims=\"1\" \/><\/a>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Select Case \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u3044\u65b9 \u3010\u69cb\u6587\u3011 Select Case &#8230; <\/p>\n","protected":false},"author":1,"featured_media":951,"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"},"categories":[48],"tags":[52,38,49],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/select01-400x3361.jpg?fit=400%2C336&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-f7","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/937"}],"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=937"}],"version-history":[{"count":12,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/937\/revisions"}],"predecessor-version":[{"id":950,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/937\/revisions\/950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/951"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}