{"id":3489,"date":"2015-09-05T10:21:40","date_gmt":"2015-09-05T01:21:40","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=3489"},"modified":"2015-09-05T10:21:40","modified_gmt":"2015-09-05T01:21:40","slug":"datavalidation06","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/datavalidation06\/","title":{"rendered":"\u5165\u529b\u898f\u5247\uff08\u4ed6\u30bb\u30eb\u3084\u6570\u5f0f\u3092\u5229\u7528\u3057\u3066\u8a31\u5bb9\u5024\u3092\u8a2d\u5b9a\uff09Validation \u30aa\u30d6\u30b8\u30a7\u30af\u30c8"},"content":{"rendered":"<h2>\u4ed6\u306e\u30bb\u30eb\u3084\u6570\u5f0f\u3092\u5229\u7528\u3057\u3066\u8a31\u5bb9\u5024\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n<div class=\"m30-l\">\n<p><a href=\"https:\/\/excelwork.info\/excel\/inputrules_formula\/\">\u5165\u529b\u898f\u5247\uff08\u305d\u306e5\uff09<\/a> \u3067\u306e\u8a2d\u5b9a\u3092\u3001\u30de\u30af\u30ed\uff08VBA\uff09\u3067\u3001\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n    \u300cA1\u300d\u304b\u3089\u300cA10\u300d\u306e\u30bb\u30eb\u306b\u5165\u529b\u898f\u5247\u3092\u8a2d\u5b9a\u3057\u3001\u300cA1\u300d\u304b\u3089\u300cA10\u300d\u307e\u3067\u306e\u30bb\u30eb\u306b\u540c\u3058\u5024\u3001\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3059\u308b\u3068\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u30c0\u30a4\u30a2\u30ed\u30b0\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>\u4f5c\u6210\u624b\u9806<\/h3>\n<div class=\"m30-l\">\n<ol style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>\u300cA1\u300d\u304b\u3089\u300cA10\u300d\u306e\u7bc4\u56f2\u306b\u5165\u529b\u898f\u5247\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li><strong>Validation.Add \u30e1\u30bd\u30c3\u30c9<\/strong> \u306e \u5f15\u6570 <em>Type<\/em> \u306b\u3001<strong>xlValidateCustom<\/strong>\uff08\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li><strong>Validation.Add \u30e1\u30bd\u30c3\u30c9<\/strong> \u306e \u5f15\u6570 <em>Formula1<\/em>\uff08\u6570\u5f0f\uff09 \u306b\u3001\u300c&#8221;=COUNTIF($A$1:$A$10,A1)=1&#8243;\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u95a2\u3059\u308b\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/li>\n<li>\u30bb\u30eb\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3057\u305f\u6642\u306b\u8868\u793a\u3059\u308b\u3001\u5165\u529b\u6642\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u95a2\u3059\u308b\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/li>\n<\/ol><\/div>\n<\/div>\n<br \/><br \/>\n<h2>\u5165\u529b\u898f\u5247\uff08\u4ed6\u30bb\u30eb\u3084\u6570\u5f0f\u3092\u5229\u7528\u3057\u3066\u8a31\u5bb9\u5024\u3092\u8a2d\u5b9a\uff09<\/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=\"\u5165\u529b\u898f\u5247\uff08\u4ed6\u30bb\u30eb\u3084\u6570\u5f0f\u3092\u5229\u7528\u3057\u3066\u8a31\u5bb9\u5024\u3092\u8a2d\u5b9a\uff09\u4f5c\u6210\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample06_Validation()\r\n\r\n    \r\n    With Range(\"A1:A10\").Validation\r\n    \r\n        '\u5165\u529b\u898f\u5247\u3092\u524a\u9664\r\n        .Delete\r\n        \r\n        '\u5165\u529b\u898f\u5247\u3092\u8a2d\u5b9a\r\n        '\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u300c\u505c\u6b62\u300d\r\n        '\u300cA1\u300d\u304b\u3089\u300cA10\u300d\u307e\u3067\u3067\u3001\u540c\u3058\u5024\u3092\u5165\u529b\u3059\u308b\u3068\u30a8\u30e9\u30fc\r\n        .Add Type:=xlValidateCustom, _\r\n             AlertStyle:=xlValidAlertStop, _\r\n             Operator:=xlBetween, _\r\n             Formula1:=\"=COUNTIF($A$1:$A$10,A1)=1\"\r\n             \r\n        .IgnoreBlank = True         '\u7a7a\u767d\u7121\u8996\r\n        .InCellDropdown = True\r\n        \r\n        '\u5165\u529b\u6642\u30e1\u30c3\u30bb\u30fc\u30b8\r\n        .ShowInput = True\r\n        .InputTitle = \"\u5165\u529b\"\r\n        .InputMessage = \"A1 - A10 \u306e\u30bb\u30eb\u7bc4\u56f2\u5185\u306b\u3001\u91cd\u8907\u3057\u306a\u3044\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\"\r\n\r\n        '\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\r\n        .ShowError = True\r\n        .ErrorTitle = \"\u30a8\u30e9\u30fc\"\r\n        .ErrorMessage = \"\u91cd\u8907\u3057\u305f\u5024\u306f\u5165\u529b\u3067\u304d\u307e\u305b\u3093\uff01\"\r\n        .IMEMode = xlIMEModeNoControl\r\n\r\n    End With\r\n    \r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p>\u5165\u529b\u898f\u5247\u3092\u8a2d\u5b9a\u3057\u305f\u30bb\u30eb\u306b\u5165\u529b<\/p>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01.jpg?ssl=1\" rel=\"lightbox[3489]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01.jpg?resize=580%2C331&#038;ssl=1\" alt=\"Validation \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3000\u4f7f\u7528\u4f8b\uff16\" width=\"580\" height=\"331\" class=\"alignnone size-large wp-image-3490\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01.jpg?resize=580%2C331&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01.jpg?resize=400%2C228&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01.jpg?w=647&amp;ssl=1 647w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4ed6\u306e\u30bb\u30eb\u3084\u6570\u5f0f\u3092\u5229\u7528\u3057\u3066\u8a31\u5bb9\u5024\u3092\u8a2d\u5b9a\u3059\u308b \u5165\u529b\u898f\u5247\uff08\u305d\u306e5\uff09 \u3067\u306e\u8a2d\u5b9a\u3092\u3001\u30de\u30af\u30ed &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3559,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[268],"tags":[270,538,63,38,269],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/09\/validation_006_01-580x3311.jpg?fit=580%2C331&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-Uh","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3489"}],"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=3489"}],"version-history":[{"count":5,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3489\/revisions"}],"predecessor-version":[{"id":3558,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3489\/revisions\/3558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/3559"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=3489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=3489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=3489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}