﻿{"id":628,"date":"2012-07-03T16:05:49","date_gmt":"2012-07-03T07:05:49","guid":{"rendered":"http:\/\/fujiitoshiki.com\/improvesociety\/?p=628"},"modified":"2014-11-07T16:51:45","modified_gmt":"2014-11-07T07:51:45","slug":"extract-from-text-revised-edition-of-mets-table-of-physical-activities","status":"publish","type":"post","link":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=628","title":{"rendered":"Extract from text revised edition of &#8220;METs table of Physical Activities&#8221;"},"content":{"rendered":"<div class=\"theContentWrap-ccc\"><p>National Institute of Health and Nutrition has revised <a title=\"'METs table of Physical Activities' 2011 edition\" href=\"\/\/www0.nih.go.jp\/eiken\/programs\/2011mets.pdf\" target=\"_blank\">&#8216;METs table of Physical Activities&#8217; 2011 edition<\/a>. Because it&#8217;s difficult to use as PDF file, I have extracted text data from it. I have asked if I could publish the file on this blog on July 3rd, 2012.<\/p>\n<p>1. Open the file and copy all text.<\/p>\n<p>2. Create new EXCEL book and paste with &#8216;Text File Wizard&#8217;. In the second tab, you have to remove all check mark of delimiters. In the third tab, select &#8216;String&#8217; data type of column.<\/p>\n<p>3. Press &#8216;Alt&#8217; key and &#8216;F11&#8217; key to launch VBE, insert module, and run the following code.<\/p>\n<pre class=\"lang:vb decode:true\">Option Explicit\r\nSub METS()\r\nDim mySht   As Worksheet\r\nDim myRng   As Range\r\nDim myAr    As Variant\r\nDim i       As Long\r\nDim j       As Long\r\nDim myReg   As Object\r\nDim myMatches   As Object\r\nDim myMatch     As Object\r\nConst strReg    As String = \"^[0-9]{5}$\"\r\nDim CODE()  As String\r\nDim METS()  As Single\r\nDim MajorHeading()  As String\r\nDim SpecificActivities()    As String\r\nDim myArray()   As Variant\r\nSet myReg = CreateObject(\"VBScript.RegExp\")\r\nWith myReg\r\n    .Pattern = strReg\r\n    .IgnoreCase = True\r\n    .Global = True\r\nEnd With\r\n\r\nSet mySht = ActiveSheet\r\nSet myRng = mySht.UsedRange\r\nmyAr = myRng\r\nj = 0\r\nFor i = LBound(myAr) To UBound(myAr)\r\n    If myReg.Test(myAr(i, 1)) Then\r\n        Set myMatches = myReg.Execute(myAr(i, 1))\r\n        ReDim Preserve CODE(j)\r\n        ReDim Preserve METS(j)\r\n        ReDim Preserve MajorHeading(j)\r\n        ReDim Preserve SpecificActivities(j)\r\n        CODE(j) = myAr(i, 1)\r\n        METS(j) = myAr(i + 1, 1)\r\n        MajorHeading(j) = myAr(i + 2, 1)\r\n        SpecificActivities(j) = myAr(i + 3, 1)\r\n        j = j + 1\r\n    End If\r\nNext i\r\nReDim myArray(j, 3)\r\nFor j = LBound(myArray) To UBound(myArray) - 1\r\n    myArray(j, 0) = CODE(j)\r\n    myArray(j, 1) = METS(j)\r\n    myArray(j, 2) = MajorHeading(j)\r\n    myArray(j, 3) = SpecificActivities(j)\r\nNext j\r\nSet mySht = Worksheets.Add\r\nmySht.Range(\"A1\").Value = \"CODE\"\r\nmySht.Range(\"B1\").Value = \"METS\"\r\nmySht.Range(\"C1\").Value = \"MajorHeading\"\r\nmySht.Range(\"D1\").Value = \"SpecificActivities\"\r\nmySht.Range(\"A2:D827\") = myArray\r\nEnd Sub\r\n<\/pre>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>National Institute of Health and Nutrition has revised &#8216;METs table of Physical Activities&#8217; 2011 ed &hellip; <a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=628\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Extract from text revised edition of &#8220;METs table of Physical Activities&#8221;&#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,4],"tags":[603,267,268,153],"class_list":["post-628","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","category-nutrition","tag-excel","tag-mets-table-of-physical-activities","tag-national-institute-of-health-and-nutrition","tag-vba"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/628","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=628"}],"version-history":[{"count":17,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions"}],"predecessor-version":[{"id":1330,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions\/1330"}],"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=628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}