{"id":10469,"date":"2022-04-08T07:28:53","date_gmt":"2022-04-07T22:28:53","guid":{"rendered":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/?p=10469"},"modified":"2022-04-08T07:32:36","modified_gmt":"2022-04-07T22:32:36","slug":"excelvba-formdata","status":"publish","type":"post","link":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/2022\/04\/08\/excelvba-formdata\/","title":{"rendered":"Excel\/VBA\u3067\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308b\u6700\u9069\u89e3\uff08\u7570\u8ad6\u6c42\u3080\uff09"},"content":{"rendered":"<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b7\u30fc\u30c8\u4e0a\u306e<strong>\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3089UserForm1\u304c\u73fe\u308c<\/strong>\u3001UserForm1\u306e\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001TextBox1\u306b\u5165\u529b\u3057\u305f<strong>\u6570\u5024\u306e10\u500d\u3092A1\u30bb\u30eb\u306b\u5165\u529b<\/strong>\u3055\u308c\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3093\u3060\u3068\u3057\u307e\u3059\u3002\u3053\u306e\u6642\u3001\u8a08\u7b97\u306f\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u5074\u3067\u884c\u3046\u3082\u306e\u3068\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2022\/04\/vba01b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10473\" src=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2022\/04\/vba01b.png\" alt=\"\" width=\"624\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u3088\u304f\u3042\u308b\u30d1\u30bf\u30fc\u30f3\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3080\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u30dc\u30bf\u30f3\u62bc\u4e0b\u3067test\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u3092\u547c\u3073\u51fa\u3057\u3066UserForm1\u3092\u8868\u793a\u3055\u305b\u308b\u3063\u3066\u3084\u3064\u3067\u3059\u3002cal\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306fUserForm1\u304b\u3089\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u7528\u3067\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nSub test()\r\n    UserForm1.Show\r\nEnd Sub\r\n\r\nSub cal(a)\r\n    Sheets(&quot;Sheet1&quot;).Range(&quot;A1&quot;).Value = a * 10\r\nEnd Sub\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>UserForm1\u5074\u306e\u30b3\u30fc\u30c9\u306f\u3053\u3061\u3089\u3002\u30dc\u30bf\u30f3\u62bc\u4e0b\u5f8c\u306e\u51e6\u7406\u3067\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nPrivate Sub CommandButton1_Click()\r\n    a = CInt(TextBox1.Text)\r\n    Call cal(a)\r\n    Me.Hide\r\nEnd Sub\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u3061\u3087\u3063\u3068\u3057\u305f\u30de\u30af\u30ed\u3060\u3063\u305f\u3089\u3053\u3093\u306a\u611f\u3058\u3067\u4f5c\u308b\u3093\u3058\u3083\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u3067\u3082\u3001UserForm\u306e\u518d\u5229\u7528\u3068\u3044\u3046\u89b3\u70b9\u304b\u3089\u3059\u308b\u3068\u3001\u6b20\u70b9\u306e\u591a\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u5225\u30b7\u30fc\u30c8\u306e\u7570\u306a\u308b\u30bb\u30eb\u306b\u5165\u529b\u3059\u308b\u3068\u306a\u3063\u305f\u5834\u5408\u3067\u3059\u3002\u4e0a\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u30b7\u30fc\u30c8\u540d\u3082\u30bb\u30eb\u4f4d\u7f6e\u3082\u56fa\u5b9a\u306a\u306e\u3067\u518d\u5229\u7528\u304c\u56f0\u96e3\u306b\u306a\u308a\u307e\u3059\u3002\u7d50\u679c\u3001<strong>\u307b\u307c\u540c\u3058UserForm\u3092\u4f5c\u3063\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u30b1\u30fc\u30b9\u304c\u6563\u898b\u3055\u308c\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3053\u308c\u306b\u5bfe\u3059\u308b\u50d5\u306e\u4eca\u306e\u3068\u3053\u308d\u306e\u6700\u9069\u89e3\u306f\u4ee5\u4e0b\u3067\u3059\u3002UserForm\u3092\u518d\u5229\u7528\u3059\u308b\u3057\u306a\u3044\u306b\u9650\u3089\u305a\u3053\u306e\u3088\u3046\u306a\u65b9\u6cd5\u3092\u53d6\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>\u300cCommon\u300d\u3068\u3044\u3046\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u7528\u610f\u3057\u3066\u304a\u304f\u3002\u203b\u30e2\u30b8\u30e5\u30fc\u30eb\u540d\u306f\u4efb\u610f<\/li>\n<li>\u305d\u3053\u306bPublic\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u304a\u304f\u3002<\/li>\n<li>Form\u304b\u3089\u306e\u30c7\u30fc\u30bf\u306f\u305d\u306ePublic\u5909\u6570\u306b\u6295\u3052\u3066\u3001\u6a19\u6e96\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306f\u305d\u3053\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\u3002<\/li>\n<li>Form\u547c\u3073\u51fa\u3057\u3068\u305d\u306e\u5f8c\u306e\u51e6\u7406\u306f\uff11\u3064\u306e\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u5185\u3067\u8cc4\u3046\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306bPublic\u5909\u6570\u7528\u306eCommon\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u306b\u306f\u5171\u901a\u3067\u4f7f\u3046\u95a2\u6570\u3082\u66f8\u3044\u305f\u308a\u3057\u307e\u3059\u3002\u3053\u306e\u4e2d\u306b<strong>Boolean\u5909\u6570\u3092\u7528\u610f\u3059\u308b<\/strong>\u3053\u3068\u304c\u809d\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2022\/04\/vba02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10475\" src=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2022\/04\/vba02.png\" alt=\"\" width=\"587\" height=\"337\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0b\u304cUserForm\u3092\u547c\u3073\u51fa\u3057\u3066\u305d\u306e\u5f8c\u51e6\u7406\u3059\u308b\u307e\u3067\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002\uff11\u3064\u306e\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002valid\u3068\u3044\u3046Boolean\u5909\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067UserForm\u306e\u72b6\u614b\u3092\u691c\u77e5\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u4e00\u65e6False\u306b\u3057\u3066\u304a\u3044\u3066\u3001UserForm\u3067True\u306b\u3057\u305f\u5834\u5408\u306e\u307f\u51e6\u7406\u5b9f\u884c\u3059\u308b\u3068\u3044\u3046\u6d41\u308c\u3067\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nSub test()\r\n    Common.valid = False\r\n    UserForm1.Show\r\n    \r\n    If Common.valid = True Then\r\n        Sheets(&quot;Sheet1&quot;).Range(&quot;A1&quot;).Value = Common.d * 10\r\n    End If\r\nEnd Sub\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0b\u304cUserForm\u3067\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u6642\u306e\u51e6\u7406\u3067\u3059\u3002Public\u5909\u6570\u306b\u5024\u3092\u6295\u3052\u3066UserForm\u3092\u9589\u3058\u308b\u3060\u3051\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nPrivate Sub CommandButton1_Click()\r\n    Common.valid = True\r\n    Common.d = CInt(TextBox1.Text)\r\n    Me.Hide\r\nEnd Sub\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u57fa\u672c\u7684\u306b\u5f8c\u3067\u8aad\u307f\u8fd4\u3057\u3084\u3059\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u76ee\u6307\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3057\u3066\u3082UserForm\u304c\u7d61\u3080\u3068\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u304c\u5206\u96e2\u3057\u305f\u308a\u3057\u3066\u8907\u96d1\u5316\u3057\u3084\u304f\u306a\u308a\u307e\u3059\u3002\u3044\u308d\u3044\u308d\u8a66\u3057\u3066\u307f\u3066\u4eca\u3053\u3093\u306a\u611f\u3058\u306b\u843d\u3061\u7740\u3044\u3066\u3044\u307e\u3059\u3002\u73fe\u6642\u70b9\u3067\u6700\u9069\u89e3\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u4ed6\u306b\u826f\u3044\u65b9\u6cd5\u304c\u3042\u3063\u305f\u3089\u3044\u3064\u3067\u3082\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\u306e\u3067\u9023\u7d61\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b7\u30fc\u30c8\u4e0a\u306e\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3089UserForm1\u304c\u73fe\u308c\u3001User &#8230; <\/p>\n","protected":false},"author":1,"featured_media":10479,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,6],"tags":[],"class_list":["post-10469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","category-vba"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/10469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/comments?post=10469"}],"version-history":[{"count":7,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/10469\/revisions"}],"predecessor-version":[{"id":10481,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/10469\/revisions\/10481"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/media\/10479"}],"wp:attachment":[{"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/media?parent=10469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/categories?post=10469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/tags?post=10469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}