{"id":3213,"date":"2022-01-21T19:00:24","date_gmt":"2022-01-21T10:00:24","guid":{"rendered":"https:\/\/www.bold.ne.jp\/engineer-club\/?p=3213"},"modified":"2025-11-19T10:05:24","modified_gmt":"2025-11-19T01:05:24","slug":"vba-if","status":"publish","type":"post","link":"https:\/\/www.bold.ne.jp\/engineer-club\/vba-if","title":{"rendered":"VBA\u306b\u304a\u3051\u308bif\u3068\u306f\uff1fif\u6587\u306e\u57fa\u672c\u7684\u306a\u69cb\u6210\u3084\u6761\u4ef6\u5206\u5c90\u51e6\u7406\u306e\u65b9\u6cd5"},"content":{"rendered":"<p><strong>VBA\u3067\u6761\u4ef6\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5909\u3048\u308b\u30de\u30af\u30ed\u3092\u7d44\u3080\u5834\u5408\u3001if\u6587\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3053\u3053\u3067\u306f\u3001<span>VBA<\/span>\u306b\u304a\u3051\u308b<span>if<\/span>\u6587\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304a\u308a\u307e\u3059\u3002<br \/>\nif\u6587\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3084\u5229\u7528\u3059\u308b\u6f14\u7b97\u5b50\u306b\u3064\u3044\u3066\u77e5\u308a\u305f\u3044\u65b9\u306f\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#VBAif\">\uff11\uff0eVBA\u306b\u304a\u3051\u308bif\u3068\u306f<\/a><ul><li><a href=\"#-if\">\uff11-\uff11\uff0eif\u306e\u5f79\u5272<\/a><\/li><li><a href=\"#-if-2\">\uff11-\uff12\uff0eif\u6587\u306e\u57fa\u672c\u7684\u306a\u69cb\u6210<\/a><\/li><\/ul><\/li><li><a href=\"#i\">\uff12\uff0e\u6f14\u7b97\u5b50<\/a><ul><li><a href=\"#i-2\">\uff12-\uff11\uff0e\u6bd4\u8f03\u6f14\u7b97\u5b50<\/a><\/li><li><a href=\"#i-3\">\uff12-\uff12\uff0e\u8ad6\u7406\u6f14\u7b97\u5b50<\/a><\/li><\/ul><\/li><li><a href=\"#i-4\">\uff13\uff0e\u8907\u96d1\u306a\u6761\u4ef6\u5206\u5c90\u306b\u3064\u3044\u3066<\/a><\/li><li><a href=\"#i-5\">\uff14\uff0e\u307e\u3068\u3081<\/a><\/li><\/ul><\/div>\n<h2><span id=\"VBAif\">\uff11\uff0eVBA\u306b\u304a\u3051\u308b<span>if<\/span>\u3068\u306f<\/span><\/h2>\n<h3><span id=\"-if\">\uff11-\uff11\uff0eif\u306e\u5f79\u5272<\/span><\/h3>\n<p>VBA\u3067\u306f\u3001<span>if<\/span>\u6587\u3092\u4f7f\u3046\u3053\u3068\u306b\u3088\u308a\u6761\u4ef6\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5909\u3048\u308b\u30de\u30af\u30ed\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30de\u30af\u30ed\u3092\u7d44\u3080\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<div class=\"attention a-3\">\n<p class=\"attention-title\">\u4f8b<\/p>\n<p>\u3042\u308b\u5024\u304c<span>70<\/span>\u4ee5\u4e0a\u3067\u3042\u308c\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>&lt;<\/span>\u5408\u683c<span>&gt;<\/span>\u3068\u8868\u793a\u3055\u308c\u3001\u305d\u308c\u4ee5\u5916\u3067\u3042\u308c\u3070\u3001<\/p>\n<p>&lt;\u4e0d\u5408\u683c<span>&gt;<\/span>\u3068\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<\/div>\n<h3><span id=\"-if-2\">\uff11-\uff12\uff0eif\u6587\u306e\u57fa\u672c\u7684\u306a\u69cb\u6210<\/span><\/h3>\n<p>if\u6587\u306e\u57fa\u672c\u7684\u306a\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote>\n<p>If \u6761\u4ef6\u5f0f<span> then<\/span><\/p>\n<p>\u2460\uff1a\u6761\u4ef6\u5f0f\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>Else<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f\u304c\u507d\u306e\u5834\u5408<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>\u521d\u3081\u306b<span>&lt;If&gt;<\/span>\u3068\u5165\u529b\u3057\u3001\u30b9\u30da\u30fc\u30b9\u3092<span>1<\/span>\u3064\u958b\u3051\u3066\u6761\u4ef6\u5f0f\u3092\u5165\u529b\u3059\u308b\u3002\u307e\u305f\u30b9\u30da\u30fc\u30b9\u3092<span>1<\/span>\u3064\u7a7a\u3051\u3066<span>&lt;then&gt;<\/span>\u3068\u5165\u529b\u3057\u307e\u3059\u3002\u6b21\u306b\u6761\u4ef6\u6e80\u305f\u3059\u5834\u5408\u306e\u51e6\u7406<span>(=<\/span>\u2460<span>)<\/span>\u3092\u5165\u529b\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001<span>Else<\/span>\u3068\u5165\u529b\u3057\u3001\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406<span>(=<\/span>\u2461<span>)<\/span>\u3092\u5165\u529b\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b<span>End If<\/span>\u3068\u5165\u529b\u3057\u307e\u3059\u3002\u6761\u4ef6\u5f0f\u304c\u771f\u3067\u3042\u308c\u3070\u3001\u2460\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u2461\u306e\u51e6\u7406\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002\u6761\u4ef6\u5f0f\u304c\u507d\u306e\u5834\u5408\u3001\u2461\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u2460\u306e\u51e6\u7406\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>if\u6587\u3092\u69cb\u6210\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u6761\u4ef6\u5f0f\u3067\u4f7f\u308f\u308c\u308b<span>\u201d<\/span>\u6f14\u7b97\u5b50<span>\u201d<\/span>\u306b\u3064\u3044\u3066\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6b21\u306e\u7ae0\u3067<span>if<\/span>\u6587\u3092\u69cb\u6210\u3059\u308b\u305f\u3081\u306e\u6f14\u7b97\u5b50\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2><span id=\"i\">\uff12\uff0e\u6f14\u7b97\u5b50<\/span><\/h2>\n<p>\u6761\u4ef6\u5f0f\u3092\u66f8\u304f\u305f\u3081\u306b\u306f<span>\u201d<\/span>\u6f14\u7b97\u5b50<span>\u201d<\/span>\u3092\u7406\u89e3\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u6f14\u7b97\u5b50\u306f\u3001\u5927\u304d\u304f\u5206\u3051\u3066<span>2<\/span>\u7a2e\u985e\u3042\u308a\u307e\u3059\u3002<span>[<\/span>\u6bd4\u8f03\u6f14\u7b97\u5b50<span>]<\/span>\u3068<span>[<\/span>\u8ad6\u7406\u6f14\u7b97\u5b50<span>]<\/span>\u3067\u3059\u3002\u4ee5\u4e0b\u306f\u3001<span>if<\/span>\u6587\u306e\u6761\u4ef6\u5f0f\u3067\u4f7f\u308f\u308c\u308b\u6f14\u7b97\u5b50\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u305f\u8868\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 239px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">\u8a18\u53f7<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u610f\u5473<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 23px;\">==<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 23px;\">\u5024\u304c\u7b49\u3057\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">&lt;&gt;<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u5024\u304c\u7b49\u3057\u304f\u306a\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">&gt;<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u5024\u304c\u5927\u304d\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">&lt;<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u5024\u304c\u5c0f\u3055\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">&gt;=<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u5024\u304c\u540c\u3058\u304b\u5927\u304d\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">&lt;=<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u5024\u304c\u540c\u3058\u304b\u5c0f\u3055\u3051\u308c\u3070\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">And<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u3069\u3061\u3089\u3068\u3082\u771f\u306e\u5834\u5408\u3001\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">Or<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u3069\u3061\u3089\u304b\u304c\u771f\u306e\u5834\u5408\u3001\u771f<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 24.9367%; border-style: solid; height: 24px;\">Not<\/td>\n<td style=\"width: 75.0633%; border-style: solid; height: 24px;\">\u6761\u4ef6\u5f0f\u304c\u507d\u306e\u5834\u5408\u3001\u771f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3067\u306f\u3001\u5404\u6f14\u7b97\u5b50\u306e\u610f\u5473\u3068\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-2\">\uff12-\uff11\uff0e\u6bd4\u8f03\u6f14\u7b97\u5b50<\/span><\/h3>\n<h4>\uff12-\uff11-\uff11\uff0e\u201c==\u201d\u3001<span>\u201d&lt;&gt;\u201d<\/span>\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>\u201c==\u201d\u306e\u6f14\u7b97\u5b50\u3092\u6d3b\u7528\u3059\u308b\u4e8b\u3067\u7279\u5b9a\u306e\u5024\u306e\u307f\u306b\u52d5\u4f5c\u3059\u308b\u30de\u30af\u30ed\u3092\u7d44\u3080\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u3042\u308b\u5024<span>(=value)<\/span>\u304c<span>100<\/span>\u306e\u6642\u3060\u3051\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b\u3001\u300c\u6e80\u70b9\u3067\u3059\u300d\u3068\u8868\u793a\u3055\u308c\u308b\u30de\u30af\u30ed\u3092\u7d44\u3080\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value = 100 then\r\nMsgBox \"\u6e80\u70b9\u3067\u3059\"\r\nElse\r\n\r\nEnd If\r\n<\/pre>\n<p>\u201d&lt;&gt;\u201d\u306e\u6f14\u7b97\u5b50\u306f\u3001\u5024\u304c\u7570\u306a\u308b\u3068\u304d\u306b\u2460\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u305d\u308c\u4ee5\u5916\u306e\u6642\u306b\u2461\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u4e0a\u8a18\u30b9\u30af\u30ea\u30d7\u30c8\u306e<span>\u201d==\u201d<\/span>\u3092<span>\u201d&lt;&gt;\u201d<\/span>\u306b\u7f6e\u304d\u63db\u3048\u305f\u5834\u5408\u3001<span>value<\/span>\u304c<span>100<\/span>\u306e\u6642\u3060\u3051\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\uff12-\uff11-\uff12\uff0e\u201c&gt;\u201d\u3001<span>\u201d&gt;=\u201d<\/span>\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>\u201c&gt;\u201d\u304a\u3088\u3073<span>\u201d&gt;=\u201d<\/span>\u306e\u6f14\u7b97\u5b50\u306f\u3001\u5024\u304c\u6bd4\u8f03\u5bfe\u8c61\u3088\u308a\u5927\u304d\u3044\u6642\u306b\u771f\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u3053\u306e<span>2<\/span>\u3064\u306e\u6f14\u7b97\u5b50\u306e\u9055\u3044\u306f\u3001\u5024\u304c\u7b49\u3057\u3044\u5834\u5408\u306e\u6761\u4ef6\u5f0f\u3092\u771f\u3068\u3059\u308b\u304b\u507d\u3068\u3059\u308b\u304b\u306b\u3042\u308a\u307e\u3059\u3002<span>\u201c&gt;\u201d<\/span>\u3092\u4f7f\u3063\u305f\u5834\u5408\u3001\u5024\u304c\u7b49\u3057\u3044\u3068\u6761\u4ef6\u5f0f\u306f\u507d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u201c\uff11-\uff11\u201d\u306e<span>(<\/span>\u4f8b<span>)<\/span>\u3092\u30b3\u30fc\u30c9\u306b\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value &gt;= 70 then\r\nMsgBox \"\u5408\u683c\"\r\nElse\r\nMsgBox \"\u4e0d\u5408\u683c\"\r\nEnd If\r\n<\/pre>\n<p>\u201d&gt;=\u201d\u3092<span>\u201d&gt;\u201d<\/span>\u306b\u3059\u308b\u3068\u3001<span>value=70<\/span>\u306e\u5834\u5408\u306f\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u4e0d\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>\uff12-\uff11-\uff13\uff0e\u201c&lt;\u201d,\u201d&lt;=\u201d\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>\u201c&gt;\u201d\u304a\u3088\u3073<span>\u201d&gt;=\u201d<\/span>\u306e\u6f14\u7b97\u5b50\u306f\u3001\u5024\u304c\u6bd4\u8f03\u5bfe\u8c61\u3088\u308a\u5c0f\u3055\u3044\u6642\u306b\u771f\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u3053\u306e<span>2<\/span>\u3064\u306e\u6f14\u7b97\u5b50\u306e\u9055\u3044\u3082\u3001\u5024\u304c\u7b49\u3057\u3044\u5834\u5408\u306e\u6761\u4ef6\u5f0f\u3092\u771f\u3068\u3059\u308b\u304b\u507d\u3068\u3059\u308b\u304b\u306b\u3042\u308a\u307e\u3059\u3002<span>\u201c&lt;\u201d<\/span>\u3092\u4f7f\u3063\u305f\u5834\u5408\u3001\u5024\u304c\u7b49\u3057\u3044\u3068\u6761\u4ef6\u5f0f\u306f\u507d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u3042\u308b\u5024<span>(=value)<\/span>\u304c<span>69<\/span>\u4ee5\u4e0b\u306e\u5834\u5408\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u4e0d\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u3001<span>69<\/span>\u3088\u308a\u5024\u304c\u5927\u304d\u3051\u308c\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u308b<span>if<\/span>\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value &lt;= 69 then\r\nMsgBox \"\u4e0d\u5408\u683c\"\r\nElse\r\nMsgBox \"\u5408\u683c\"\r\nEnd If<\/pre>\n<p>\u201d&lt;=\u201d\u3092<span>\u201d&lt;\u201d<\/span>\u306b\u3059\u308b\u3068\u3001<span>value=69<\/span>\u306e\u5834\u5408\u306f\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-3\">\uff12-\uff12\uff0e\u8ad6\u7406\u6f14\u7b97\u5b50<\/span><\/h3>\n<h4>\uff12-\uff12-\uff11\uff0e\u201cAnd\u201d\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>And\u306f\u3001\u8907\u6570\u306e\u6761\u4ef6\u5f0f\u3092\u4f7f\u3044\u305f\u3044\u3068\u304d\u306b\u5229\u7528\u3057\u307e\u3059\u3002\u3053\u306e\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u305f<span>if<\/span>\u6587\u306f\u4ee5\u4e0b\u306e\u69d8\u306a\u69cb\u6210\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<p>If \u6761\u4ef6\u5f0f1 And \u6761\u4ef6\u5f0f2 then<\/p>\n<p>\u2460\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u304a\u3088\u3073<span>2<\/span>\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>Else<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u304a\u3088\u3073<span>2<\/span>\u306e\u3069\u3061\u3089\u304b\u304c\u507d\u306e\u5834\u5408<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>\u6761\u4ef6<span>1<\/span>\u53ca\u3073<span>2<\/span>\u304c\u3069\u3061\u3089\u3068\u3082\u771f\u306e\u3068\u304d\u306e\u307f\u2460\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u3069\u3061\u3089\u304b\u304c\u507d\u306e\u5834\u5408\u306f\u2461\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u3042\u308b\u5024<span>(=value1)<\/span>\u304c<span>70<\/span>\u4ee5\u4e0a\u304b\u3064\u5225\u306e\u5024<span>(=value2)<\/span>\u304c<span>70<\/span>\u4ee5\u4e0a\u3067\u3042\u308c\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u3001\u3069\u3061\u3089\u304b\u306e\u5024\u304c<span>70<\/span>\u672a\u6e80\u3067\u3042\u308c\u3070\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u4e0d\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u308b<span>if<\/span>\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value1 &gt;= 70 And value2 &gt;= 70 then\r\nMsgBox \"\u5408\u683c\"\r\nElse \r\nMsgBox \"\u4e0d\u5408\u683c\"\r\nEnd If\r\n<\/pre>\n<h4>\uff12-\uff12-\uff12\uff0e\u201cOr\u201d\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>Or\u3082<span>And<\/span>\u3068\u540c\u3058\u304f\u8907\u6570\u306e\u6761\u4ef6\u3092\u4f7f\u3044\u305f\u3044\u3068\u304d\u306b\u5229\u7528\u3057\u307e\u3059\u3002\u3053\u306e\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u305f<span>if<\/span>\u6587\u306f\u4ee5\u4e0b\u306e\u69d8\u306a\u69cb\u6210\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<p>If \u6761\u4ef6\u5f0f1 or \u6761\u4ef6\u5f0f2 then<\/p>\n<p>\u2460\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u307e\u305f\u306f<span>2<\/span>\u306e\u3069\u3061\u3089\u304b\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>Else<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u304a\u3088\u3073<span>2<\/span>\u306e\u3069\u3061\u3089\u3068\u3082\u507d\u306e\u5834\u5408<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>\u6761\u4ef6\u5f0f\uff11\u304a\u3088\u3073<span>2<\/span>\u306e\u3069\u3061\u3089\u304b<span>1<\/span>\u3064\u3067\u3082\u771f\u306e\u3068\u304d\u306b\u2460\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u3069\u3061\u3089\u3068\u3082\u507d\u3067\u3042\u308c\u3070\u2461\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u201c\uff12-\uff12-\uff11\u201d\u3067\u7d39\u4ecb\u3057\u305f<span>if<\/span>\u6587\u306e<span>And<\/span>\u3092<span>Or<\/span>\u306b\u7f6e\u304d\u63db\u3048\u308b\u3068\u3001\u3042\u308b\u5024<span>(=value1)<\/span>\u304c<span>70<\/span>\u4ee5\u4e0a\u3001\u307e\u305f\u306f\u5225\u306e\u5024<span>(=value)<\/span>\u304c<span>70<\/span>\u4ee5\u4e0a\u3067\u3042\u308c\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u3001\u3069\u3061\u3089\u3068\u3082<span>70<\/span>\u672a\u6e80\u3067\u3042\u308c\u3070\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b<span>\u201d<\/span>\u4e0d\u5408\u683c<span>\u201d<\/span>\u3068\u8868\u793a\u3055\u308c\u308b<span>if<\/span>\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\uff12-\uff12-\uff13\uff0e\u201cNot\u201d\u306e\u4f7f\u3044\u65b9<\/h4>\n<p>\u3053\u306e\u6f14\u7b97\u5b50\u3092\u4f7f\u3046\u3068\u6761\u4ef6\u5f0f\u304c\u507d\u3067\u3042\u308b\u3068\u304d\u306b\u771f\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u3001\u6761\u4ef6\u5f0f\u304c\u771f\u3067\u3042\u308b\u3068\u304d\u306b\u507d\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<span>if<\/span>\u6587\u306e\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote>\n<p>If\u00a0 Not\u3000\u6761\u4ef6\u5f0f then<\/p>\n<p>\u2460\uff1a \u6761\u4ef6\u5f0f\u304c\u507d\u306e\u5834\u5408<\/p>\n<p>Else<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>\u3053\u308c\u307e\u3067\u306e<span>if<\/span>\u6587\u3068\u306f\u7570\u306a\u308a\u3001\u6761\u4ef6\u3092\u6e80\u3055\u306a\u3044\u6642\u306b\u2460\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u201c\uff11-\uff11\u201d\u306e<span>(<\/span>\u4f8b<span>)<\/span>\u3092<span>Not<\/span>\u3067\u8868\u73fe\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u69d8\u306a<span>if<\/span>\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If Not value &gt;= 70 then\r\nMsgBox \"\u4e0d\u5408\u683c\"\r\nElse\r\nMsgBox \"\u5408\u683c\"\r\nEnd If\r\n<\/pre>\n<h2><span id=\"i-4\">\uff13\uff0e\u8907\u96d1\u306a\u6761\u4ef6\u5206\u5c90\u306b\u3064\u3044\u3066<\/span><\/h2>\n<p>Else If\u3084\u30cd\u30b9\u30c8\u3092\u4f7f\u3046\u3053\u3068\u3067\u8907\u96d1\u306a\u6761\u4ef6\u5206\u5c90\u3092\u3082\u3064<span>if<\/span>\u6587\u3092\u4f5c\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u203b\u30cd\u30b9\u30c8<span>(=<\/span>\u5165\u308c\u5b50<span>)<\/span>\u3068\u306f\u3001<span>if<\/span>\u6587\u306e\u4e2d\u306b\u3055\u3089\u306b<span>if<\/span>\u6587\u3092\u5165\u308c\u308b\u3053\u3068\u3092\u6307\u3057\u307e\u3059\u3002<\/p>\n<p>\u5148\u306b<span>Else If<\/span>\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002Else If\u3092\u4f7f\u3063\u305f<span>if<\/span>\u6587\u306e\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote>\n<p>If \u6761\u4ef6\u5f0f1 then<\/p>\n<p>\u2460\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>Else\u3000If \u6761\u4ef6\u5f0f2 then<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u306f\u507d\u3067\u6761\u4ef6\u5f0f<span>2<\/span>\u304c\u771f\u306e\u5834\u5408<\/p>\n<p>Else<\/p>\n<p>\u2462\u6761\u4ef6\u5f0f<span>1<\/span>\u53ca\u3073<span>2<\/span>\u304c\u3069\u3061\u3089\u3068\u3082\u507d\u3060\u3063\u305f\u5834\u5408<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>\u4e0a\u8a18\u306e\u901a\u308a\u3001\u8907\u6570\u306e\u6761\u4ef6\u5206\u5c90\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u3042\u308b\u5024<span>(=value)<\/span>\u304c<span>80<\/span>\u4ee5\u4e0a\u3067<span>\u201d<\/span>\u512a<span>\u201d<\/span>\u3001<span>60<\/span>\u4ee5\u4e0a\u3067<span>\u201d<\/span>\u826f<span>\u201d<\/span>\u305d\u308c\u4ee5\u5916\u3067<span>\u201d<\/span>\u4e0d\u5408\u683c<span>\u201d<\/span>\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306b\u8868\u793a\u3055\u308c\u308b<span>if<\/span>\u6587\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value &gt;= 80 then\r\nMsgBox \"\u512a\"\r\nElse\u3000If value &gt;= 60 then\r\nMsgBox \"\u826f\"\r\nElse\r\nMsgBox \"\u4e0d\u5408\u683c\"\r\nEnd If\r\n<\/pre>\n<p>\u6b21\u306b\u30cd\u30b9\u30c8\u3092\u4f7f\u3063\u305f\u65b9\u6cd5\u306e\u7d39\u4ecb\u3092\u3057\u307e\u3059\u3002\u30cd\u30b9\u30c8\u3092\u4f7f\u3063\u305f<span>if<\/span>\u6587\u306e\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote>\n<p>If \u6761\u4ef6\u5f0f<span>1 then<\/span>\u3000<\/p>\n<p>\u2460\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u3092\u6e80\u305f\u3059\u5834\u5408\u306e\u51e6\u7406<\/p>\n<p>If\u3000\u6761\u4ef6\u5f0f<span>2<\/span>\u3000<span>then<\/span><\/p>\n<p>\u2462\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u304a\u3088\u3073<span>2<\/span>\u3092\u6e80\u305f\u3059\u5834\u5408\u306e\u51e6\u7406<\/p>\n<p>\u00a0Else<\/p>\n<p>\u2463\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u306f\u6e80\u305f\u3057\u3066\u3044\u308b\u304c\u3001\u6761\u4ef6\u5f0f<span>2<\/span>\u306f\u6e80\u305f\u3055\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406<\/p>\n<p>End If<\/p>\n<p>Else<\/p>\n<p>\u2461\uff1a\u6761\u4ef6\u5f0f<span>1<\/span>\u3092\u6e80\u305f\u3055\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406<\/p>\n<p>End If<\/p>\n<\/blockquote>\n<p>Else If\u3067\u7d39\u4ecb\u3057\u305f\u30de\u30af\u30ed\u3092\u30cd\u30b9\u30c8\u3067\u8868\u73fe\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u901a\u308a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">If value &gt;=60 then\u3000\r\nIf\u3000value &gt;= 80 then\r\n  MsgBox \"\u512a\"\r\n Else\r\nMsgBox \"\u826f\"\r\nEnd If\r\nElse\r\n MsgBox \"\u4e0d\u5408\u683c\"\r\nEnd If\r\n<\/pre>\n<p>Else If\u3084\u30cd\u30b9\u30c8\u3092\u4f7f\u3046\u3053\u3068\u3067\u3088\u308a\u7d30\u304b\u3044\u6761\u4ef6\u5206\u5c90\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u304c\u3001\u5206\u5c90\u3092\u591a\u304f\u3057\u3059\u304e\u308b\u3068\u5f8c\u306e\u7de8\u96c6\u3084\u4ed6\u306e\u4eba\u3068\u306e\u5171\u6709\u304c\u56f0\u96e3\u306b\u306a\u308b\u306e\u3067\u8981\u6ce8\u610f\u3067\u3059\u3002<\/p>\n<h2><span id=\"i-5\">\uff14\uff0e\u307e\u3068\u3081<\/span><\/h2>\n<p>if\u6587\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001\u30de\u30af\u30ed\u3067\u51fa\u6765\u308b\u3053\u3068\u304c\u5927\u5e45\u306b\u5897\u3048\u307e\u3059\u3002\u305c\u3072\u3001\u3053\u3053\u3067\u5f97\u3089\u308c\u305f\u77e5\u8b58\u3092\u3054\u6d3b\u7528\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VBA\u3067\u6761\u4ef6\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5909\u3048\u308b\u30de\u30af\u30ed\u3092\u7d44\u3080\u5834\u5408\u3001if\u6587\u3092\u5229\u7528\u3057\u307e\u3059\u3002 \u3053\u3053\u3067\u306f\u3001VBA\u306b\u304a\u3051\u308bif\u6587\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304a\u308a\u307e\u3059\u3002 if\u6587\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3084\u5229\u7528\u3059\u308b\u6f14\u7b97\u5b50\u306b\u3064\u3044\u3066\u77e5\u308a\u305f\u3044\u65b9\u306f\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u4e0b\u3055\u3044\u3002 \u76ee [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":3216,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3213"}],"collection":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/comments?post=3213"}],"version-history":[{"count":9,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3213\/revisions"}],"predecessor-version":[{"id":3218,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3213\/revisions\/3218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media\/3216"}],"wp:attachment":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media?parent=3213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/categories?post=3213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}