﻿{"id":136,"date":"2012-01-25T11:49:48","date_gmt":"2012-01-25T02:49:48","guid":{"rendered":"http:\/\/fujiitoshiki.com\/improvesociety\/?p=136"},"modified":"2014-08-11T18:29:10","modified_gmt":"2014-08-11T09:29:10","slug":"post-136","status":"publish","type":"post","link":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=136","title":{"rendered":"EXCEL VBA \u30672\u6b21\u5143\u52d5\u7684\u914d\u5217\u306e\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570\u3092\u5909\u66f4\u3059\u308b"},"content":{"rendered":"<div class=\"theContentWrap-ccc\"><p>EXCEL VBA\u3067\u306e2\u6b21\u5143\u52d5\u7684\u914d\u5217\u306b\u306f\u6700\u7d42\u6b21\u5143\uff0c\u3064\u307e\u308a\u7b2c2\u6b21\u5143\u306e\u8981\u7d20\u6570\u306e\u5909\u66f4\u3057\u304b\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u5236\u7d04\u304c\u3042\u308a\u307e\u3059\uff0e\u3057\u304b\u3057\u73fe\u5b9f\u554f\u984c\u3068\u3057\u3066\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570\u3092\u5909\u66f4\u3057\u305f\u3044\u3068\u3044\u3046\u9700\u8981\u306f\u3042\u308a\u307e\u3059\uff0e\u4eca\u56de\u306f2\u6b21\u5143\u52d5\u7684\u914d\u5217\u306e\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570\u306e\u5909\u66f4\u65b9\u6cd5\u3092\u8ff0\u3079\u307e\u3059\uff0e\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u30672\u6b21\u5143\u914d\u5217\u306e\u5168\u8981\u7d20\u3092\u4e00\u65e61\u6b21\u5143\u52d5\u7684\u914d\u5217\u306b\u66f8\u304d\u51fa\u3057\uff0c1\u6b21\u5143\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u5897\u3084\u3057\u3066\u304b\u3089\u518d\u5ea62\u6b21\u5143\u914d\u5217\u306b\u66f8\u304d\u623b\u3057\u3066\u3044\u307e\u3059\uff0e<\/p>\n<pre class=\"lang:vb decode:true \" >\r\nOption Explicit\r\nSub DynamicArray_Sample()\r\nDim mySht   As Worksheet\r\nDim myRng   As Range\r\nDim tmpAr   As Variant\r\nDim myAr()  As String\r\nDim myID()  As String\r\nDim myStr() As String\r\nDim i       As Long\r\nSet mySht = Worksheets.Add\r\nWith mySht\r\n    .Range(\"A1\").Value = \"10001\"\r\n    .Range(\"A2\").Value = \"10002\"\r\n    .Range(\"A3\").Value = \"10003\"\r\n    .Range(\"A4\").Value = \"10004\"\r\n    .Range(\"A5\").Value = \"10005\"\r\n    .Range(\"B1\").Value = \"aaaaa\"\r\n    .Range(\"B2\").Value = \"bbbbb\"\r\n    .Range(\"B3\").Value = \"ccccc\"\r\n    .Range(\"B4\").Value = \"ddddd\"\r\n    .Range(\"B5\").Value = \"eeeee\"\r\nEnd With\r\nSet myRng = mySht.UsedRange\r\ntmpAr = myRng\r\nFor i = LBound(tmpAr) To UBound(tmpAr)\r\n    ReDim Preserve myID(i)\r\n    ReDim Preserve myStr(i)\r\n    myID(i) = myAr(i, 0)\r\n    myStr(i) = myAr(i, 1)\r\nNext i\r\nReDim Preserve myID(UBound(myID) + 1)\r\nReDim Preserve myStr(UBound(myStr) + 1)\r\nmyID(UBound(myID)) = \"10006\"\r\nmyStr(UBound(myStr)) = \"fffff\"\r\nReDim myAr(UBound(myID), 1)\r\nFor i = LBound(myAr) To UBound(myAr)\r\n    myAr(i, 0) = myID(i)\r\n    myAr(i, 1) = myStr(i)\r\nNext i\r\nSet mySht = Worksheets.Add\r\nWith mySht\r\n    .Range(\"A1:B6\") = myAr\r\nEnd With\r\nSet mySht = Nothing\r\nEnd Sub\r\n<\/pre>\n<p><iframe src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=fujiitoshiki-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=479736761X\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>EXCEL VBA\u3067\u306e2\u6b21\u5143\u52d5\u7684\u914d\u5217\u306b\u306f\u6700\u7d42\u6b21\u5143\uff0c\u3064\u307e\u308a\u7b2c2\u6b21\u5143\u306e\u8981\u7d20\u6570\u306e\u5909\u66f4\u3057\u304b\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u5236\u7d04\u304c\u3042\u308a\u307e\u3059\uff0e\u3057\u304b\u3057\u73fe\u5b9f\u554f\u984c\u3068\u3057\u3066\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570\u3092\u5909\u66f4\u3057\u305f\u3044\u3068\u3044\u3046\u9700\u8981\u306f\u3042\u308a\u307e\u3059\uff0e\u4eca\u56de\u306f2\u6b21\u5143\u52d5\u7684\u914d\u5217\u306e\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570 &hellip; <a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=136\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;EXCEL VBA \u30672\u6b21\u5143\u52d5\u7684\u914d\u5217\u306e\u7b2c1\u6b21\u5143\u306e\u8981\u7d20\u6570\u3092\u5909\u66f4\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6026,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[307,603,153,308,309],"class_list":["post-136","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","tag-307","tag-excel","tag-vba","tag-308","tag-309"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=136"}],"version-history":[{"count":8,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/136\/revisions"}],"predecessor-version":[{"id":5971,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/136\/revisions\/5971"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/media\/6026"}],"wp:attachment":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}