{"id":2148,"date":"2015-02-18T10:55:13","date_gmt":"2015-02-18T01:55:13","guid":{"rendered":"http:\/\/www23.atpages.jp\/~inoni\/?p=2148"},"modified":"2017-10-20T17:27:23","modified_gmt":"2017-10-20T08:27:23","slug":"excelvba%e8%a6%9a%e6%9b%b8-%e6%ad%a3%e8%a6%8f%e8%a1%a8%e7%8f%be","status":"publish","type":"post","link":"http:\/\/anada.cloudfree.jp\/?p=2148","title":{"rendered":"ExcelVBA\u899a\u66f8 \u6b63\u898f\u8868\u73fe"},"content":{"rendered":"<p>\u79c1\u304c\u82e6\u624b\u306a\u3082\u306e\u306e\uff11\u3064\u300c\u6b63\u898f\u8868\u73fe\u300d<br \/>\n\u3044\u3064\u307e\u3067\u3082\u9003\u3052\u3089\u308c\u306a\u3044\u306e\u3067\u3001\u304c\u3093\u3070\u3063\u3066\u307f\u305f\u3002<\/p>\n<p>\u307e\u305a\u306f<strong>\u6574\u6570<\/strong><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n'\u6574\u6570\uff08\u4e0a\u9650\u304c5\u6841 -99999\uff5e99999\u306fOK)\nDim rng As Range           '\u5bfe\u8c61\u30bb\u30eb\nDim res As Boolean         '\u7d50\u679c\n\nSet rng = ActiveCell       '\u9078\u629e\u3057\u3066\u3044\u308b\u30bb\u30eb\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\nSet reg = CreateObject(&quot;VBScript.RegExp&quot;)\nWith reg\n     .IgnoreCase = True             '\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u306f\u95a2\u4fc2\u306a\u3044\n     .Global = True                 '\u5168\u4f53\u3092\u30c1\u30a7\u30c3\u30af\n     .Pattern = &quot;^&#x5B;-]?&#x5B;0-9]{1,5}$&quot;\n     If .Test(rng.Value) Then\n          res = True\n          Exit Function\n     End If\nEnd With\n\n<\/pre>\n<p>\u6b21\u306f<strong>\u5b9f\u6570<\/strong><br \/>\n\u3053\u3044\u3064\u304c\u3084\u3084\u3053\u3057\u304f\u3066\u3001\u6574\u6570\u306e\u3068\u304d\u3068\u5b9f\u6570\u306e\u3068\u304d\u3068\u3067\u5206\u3051\u3066\u3084\u3089\u306a\u3044\u3068\u3044\u3051\u306a\u3044<br \/>\n.Pattern = &#8220;^[-]?[0-9]{1,3}[.]?[0-9]{0,2}$&#8221;<br \/>\n\u3060\u3051\u306b\u3059\u308b\u3068\u6574\u65704\u6841\u30015\u6841\u306e\u6570\u5024\u3082OK\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n'\u5b9f\u6570\uff08\u4e0a\u9650\u304c5\u6841 -999.99\uff5e999.99\u306fOK)\nDim rng As Range           '\u5bfe\u8c61\u30bb\u30eb\nDim res As Boolean         '\u7d50\u679c\n\nSet rng = ActiveCell      \nSet reg = CreateObject(&quot;VBScript.RegExp&quot;)\nWith reg\n     .IgnoreCase = True   \n     .Global = True       \n     '\u6574\u6570\u306e\u5834\u5408\u306e\u30c1\u30a7\u30c3\u30af\n     .Pattern = &quot;^&#x5B;-]?&#x5B;0-9]{1,3}$&quot;\n     If .Test(rng.Value) Then\n          res = True\n          Exit Function\n     End If\n     '\u5b9f\u6570\u306e\u5834\u5408\u306e\u30c1\u30a7\u30c3\u30af\n     .Pattern = &quot;^&#x5B;-]?&#x5B;0-9]{1,3}&#x5B;.]{1,1}&#x5B;0-9]{0,2}$&quot;\n     If .Test(rng.Value) Then\n          res= True\n          Exit Function\n     End If    \nEnd With\n<\/pre>\n<p>\u305d\u3057\u3066\u3001<strong>\u82f1\u6570\u5b57<\/strong>\u306e\u307f<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n'\u82f1\u6570\u5b57\u306e\u307f\uff08\u4e0a\u9650\u304c5\u6841\u3067\u3001\u534a\u89d2\u306e\u307f\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57OK)\nDim rng As Range           '\u5bfe\u8c61\u30bb\u30eb\nDim res As Boolean         '\u7d50\u679c\n\nSet rng = ActiveCell      \nSet reg = CreateObject(&quot;VBScript.RegExp&quot;)\nWith reg\n     .IgnoreCase = True   \n     .Global = True       \n     .Pattern = &quot;^&#x5B;a-z0-9]{0,5}$&quot;\n     If .Test(rng.Value) Then\n          res = True\n          Exit Function\n     End If     \nEnd With\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u79c1\u304c\u82e6\u624b\u306a\u3082\u306e\u306e\uff11\u3064\u300c\u6b63\u898f\u8868\u73fe\u300d \u3044\u3064\u307e\u3067\u3082\u9003\u3052\u3089\u308c\u306a\u3044\u306e\u3067\u3001\u304c\u3093\u3070\u3063\u3066\u307f\u305f\u3002 \u307e\u305a\u306f\u6574\u6570 &#8216;\u6574\u6570\uff08\u4e0a\u9650\u304c5\u6841 -99999\uff5e99999\u306fOK) Dim rng As Range &#8216;\u5bfe\u8c61\u30bb\u30eb Dim res As Boo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[43,74],"class_list":["post-2148","post","type-post","status-publish","format-standard","hentry","category-excelvba","tag-excel","tag-vba"],"_links":{"self":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/2148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2148"}],"version-history":[{"count":1,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/2148\/revisions"}],"predecessor-version":[{"id":2674,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/2148\/revisions\/2674"}],"wp:attachment":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2148"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}