{"id":1923,"date":"2015-05-19T10:03:00","date_gmt":"2015-05-19T01:03:00","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=1923"},"modified":"2015-05-19T10:03:00","modified_gmt":"2015-05-19T01:03:00","slug":"funcswitch","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/funcswitch\/","title":{"rendered":"\u5f0f\u306e\u5024\u306b\u5fdc\u3058\u3066\u591a\u5206\u5c90\u3092\u884c\u3046\uff08Switch \u95a2\u6570\uff09"},"content":{"rendered":"<h2>Switch \u95a2\u6570 \u306e\u4f7f\u3044\u65b9<\/h2>\n<br \/>\n<div class=\"m30-l\">\n<p><strong>Switch \u95a2\u6570<\/strong>\u306f\u3001\u300c\u5f0f\u30fb\u5024\u300d\u3092\u5bfe\u306b\u3057\u3066\u6307\u5b9a\u3057\u3066\u3001\u5de6\u304b\u3089\u9806\u306b\u8a55\u4fa1\u3057\u3001\u6700\u521d\u306b\u771f\uff08True\uff09\u306b\u8a55\u4fa1\u3055\u308c\u305f\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p><em>result<\/em> = <strong>Switch<\/strong> ( <em>expr1<\/em>, <em>value1<\/em> [, <em>expr2<\/em>, <em>value2<\/em>, &#8230; , <em>exprn<\/em>, <em>valuen<\/em> ] )<\/p>\n<\/div>\n<br \/>\n<h3>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>expr1,expr2 &#8230; exprn&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u8a55\u4fa1\u5bfe\u8c61\u306e\u5f0f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>value1,value2 &#8230; valuen&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u5fdc\u3059\u308b\u5f0f\uff08 <em>expr1<\/em>, <em>expr2<\/em> &#8230; <em>exprn<\/em> \uff09\u304c<strong>\u771f\uff08True\uff09<\/strong>\u306e\u5834\u5408\u306b\u8fd4\u3059<strong>\u5f0f\u30fb\u5024<\/strong>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>result&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570\uff08 <em>expr1<\/em>, <em>expr2<\/em> &#8230; <em>exprn<\/em> \uff09\u3067\u6700\u521d\u306b\u3001<strong>\u771f\uff08True\uff09<\/strong>\u3068\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u306b\u5bfe\u5fdc\u3059\u308b <strong><em>Value<\/em><\/strong>\u3002<\/li>\n<\/ul>\n<br \/><br \/>\n<p class=\"caution4\"><strong>Switch \u95a2\u6570<\/strong>\u306f\u3001\u5de6\u304b\u3089\u53f3\u306e\u9806\u3067\u5f0f\u3092\u8a55\u4fa1\u3057\u3001\u6700\u521d\u306b<strong>\u771f\uff08True\uff09<\/strong>\u3068\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u306b\u5bfe\u5fdc\u3057\u305f\u5024\uff08\u5f0f\uff09\u304c\u8fd4\u3055\u308c\u307e\u3059\u304c\u3001<span class=\"blue\">\u8a55\u4fa1\u306f\u3059\u3079\u3066\u306e\u5f0f\u306b\u5bfe\u3057\u3066\u884c\u308f\u308c\u307e\u3059<\/span>\u3002\u3053\u306e\u305f\u3081\u3001\u8a55\u4fa1\u3059\u308b\u3068 0 \u306b\u3088\u308b<strong>\u9664\u7b97\u30a8\u30e9\u30fc<\/strong>\u304c\u767a\u751f\u3059\u308b\u5f0f\u304c\uff11\u3064\u3067\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002\n<\/p>\n<p class=\"caution4\">\u771f\uff08True\uff09\u3068\u8a55\u4fa1\u3055\u308c\u305f\u6700\u521d\u306e\u5f0f\u306b\u3001<strong>Null \u5024<\/strong>\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u5834\u5408\u3001<strong>Null \u5024<\/strong>\u3092\u8fd4\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u3059\u3079\u3066\u306e\u5f0f\u304c\u771f\uff08True\uff09\u3068\u8a55\u4fa1\u3055\u308c\u306a\u3044\u5834\u5408\u3082 <strong>Null \u5024<\/strong>\u3092\u8fd4\u3057\u307e\u3059\u3002\n<\/p>\n<\/div>\n<br \/><br \/>\n<h2>Switch \u95a2\u6570 \u306e\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Switch \u95a2\u6570\u306e\u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\n\r\nSub Sample_Switch()\r\n\r\n\r\n    Dim str, ret\r\n    str = InputBox(\"\u6570\u5b57\u300c1-3\u300d\u306e\u3044\u305a\u308c\u304b\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\")\r\n    ret = Switch(str = 1, \"1 \u3092\u5165\u529b\", str = 2, \"2 \u3092\u5165\u529b\", str = 3, \"3 \u3092\u5165\u529b\")\r\n                  \r\n    If Not IsNull(ret) Then\r\n        \r\n        MsgBox ret\r\n    \r\n    Else\r\n    \r\n        MsgBox \"\u300c1-3\u300d\u4ee5\u5916\u3092\u5165\u529b\u3057\u307e\u3057\u305f\"\r\n    \r\n    End If\r\n    \r\n    \r\n    \r\nEnd Sub\r\n\r\n\r\n\u3000\r\n<\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c\uff08\u300c2\u300d\u3092\u5165\u529b\uff09<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch01.jpg?ssl=1\" rel=\"lightbox[1923]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch01.jpg?resize=400%2C139&#038;ssl=1\" alt=\"Switch \u95a2\u6570 \u4f8b01\" width=\"400\" height=\"139\" class=\"alignnone size-medium wp-image-1925\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch01.jpg?resize=400%2C139&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch01.jpg?w=429&amp;ssl=1 429w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n<br \/>\n<a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch02.jpg?ssl=1\" rel=\"lightbox[1923]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch02.jpg?resize=154%2C178&#038;ssl=1\" alt=\"Switch \u95a2\u6570 \u4f8b02\" width=\"154\" height=\"178\" class=\"alignnone size-full wp-image-1926\" data-recalc-dims=\"1\" \/><\/a><br \/>\n<br \/><\/p>\n<h3>\u5b9f\u884c\u7d50\u679c\uff08\u300cabc\u300d\u3092\u5165\u529b\uff09<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch03.jpg?ssl=1\" rel=\"lightbox[1923]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch03.jpg?resize=400%2C139&#038;ssl=1\" alt=\"Switch \u95a2\u6570 \u4f8b03\" width=\"400\" height=\"139\" class=\"alignnone size-medium wp-image-1927\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch03.jpg?resize=400%2C139&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch03.jpg?w=429&amp;ssl=1 429w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n<br \/>\n<a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch04.jpg?ssl=1\" rel=\"lightbox[1923]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch04.jpg?resize=217%2C178&#038;ssl=1\" alt=\"Switch \u95a2\u6570 \u4f8b04\" width=\"217\" height=\"178\" class=\"alignnone size-full wp-image-1928\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Switch \u95a2\u6570 \u306e\u4f7f\u3044\u65b9 Switch \u95a2\u6570\u306f\u3001\u300c\u5f0f\u30fb\u5024\u300d\u3092\u5bfe\u306b\u3057\u3066\u6307\u5b9a\u3057\u3066 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1935,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[37],"tags":[52,254,63,38,256,255],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/switch01-400x1391.jpg?fit=400%2C139&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-v1","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1923"}],"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=1923"}],"version-history":[{"count":5,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1923\/revisions"}],"predecessor-version":[{"id":1934,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1923\/revisions\/1934"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/1935"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=1923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=1923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=1923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}