{"id":2387,"date":"2018-08-22T02:42:34","date_gmt":"2018-08-21T17:42:34","guid":{"rendered":"http:\/\/okamurax.com\/?p=2387"},"modified":"2020-01-15T11:25:35","modified_gmt":"2020-01-15T02:25:35","slug":"vba-%e3%82%b7%e3%83%bc%e3%83%88%e3%81%ae%e3%82%b3%e3%83%94%e3%83%bc","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=2387","title":{"rendered":"VBA  \u30b7\u30fc\u30c8\u9593\u306e\u30b3\u30d4\u30fc"},"content":{"rendered":"<p>\u30b7\u30fc\u30c8\u9593\u306e\u30b3\u30d4\u30fc<\/p>\n<pre class=\"lang:vb decode:true \">Sub Excute()\r\n\r\nSet w = Sheets(\"\u30de\u30b9\u30bf\u767b\u9332\u7528\")\r\n\r\nDim hayStack As Range: Set hayStack = Sheets(\"\u54c1\u76ee\u30de\u30b9\u30bf\").Range(\"D15:D8462\")\r\n\r\nFor r = 3 To 3592\r\n  \r\n  If (r Mod 5) = 0 Then DoEvents\r\n  \r\n  productName = x(w.Cells(r, 1).Text)\r\n  productNote = x(w.Cells(r, 4).Text)\r\n  productItem = x(w.Cells(r, 5).Text)\r\n  productKg = x(w.Cells(r, 24).Text)\r\n  productLength = x(w.Cells(r, 25).Text)\r\n  productWidth = x(w.Cells(r, 26).Text)\r\n  productHeight = x(w.Cells(r, 27).Text)\r\n\r\n  If productName &lt;&gt; \"\" Then Call Pour(hayStack, productName, productNote, productItem, productKg, productLength, productWidth, productHeight)\r\n\r\n  Application.StatusBar = r\r\n\r\nNext r\r\n\r\nApplication.StatusBar = False\r\nMsgBox \"done\"\r\n\r\nEnd Sub\r\n\r\nFunction x(target)\r\ntarget = Replace(target, vbCrLf, \"\")\r\ntarget = Replace(target, vbCr, \"\")\r\ntarget = Replace(target, vbLf, \"\")\r\nx = target\r\nEnd Function\r\n\r\nSub Pour(hayStack, productName, productNote, productItem, productKg, productLength, productWidth, productHeight)\r\n\r\nSet w = Sheets(\"\u54c1\u76ee\u30de\u30b9\u30bf\")\r\n\r\nFor Each c In hayStack\r\n\r\n  If (c.Text = productName) Then\r\n    w.Cells(c.Row, 187) = productNote\r\n    If productItem &lt;&gt; \"\" Then t = \"1\"\r\n    w.Cells(c.Row, 179) = t\r\n    w.Cells(c.Row, 180) = productKg\r\n    w.Cells(c.Row, 181) = productLength\r\n    w.Cells(c.Row, 182) = productWidth\r\n    w.Cells(c.Row, 183) = productHeight\r\n  End If\r\n\r\nNext\r\n\r\nEnd Sub\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30b7\u30fc\u30c8\u9593\u306e\u30b3\u30d4\u30fc Sub Excute() Set w = Sheets(&#8220;\u30de\u30b9\u30bf\u767b\u9332\u7528&#8221;) Dim hayStack As Range: Set hayStack = Sheets(&#8220;\u54c1\u76ee\u30de\u30b9\u30bf&#8221;).Range(&#8220;D1 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=2387\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;VBA  \u30b7\u30fc\u30c8\u9593\u306e\u30b3\u30d4\u30fc&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5],"class_list":["post-2387","post","type-post","status-publish","format-standard","hentry","category-1","tag-vba"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2387"}],"version-history":[{"count":3,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2387\/revisions"}],"predecessor-version":[{"id":2390,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2387\/revisions\/2390"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}