﻿{"id":8058,"date":"2019-07-25T06:00:00","date_gmt":"2019-07-24T21:00:00","guid":{"rendered":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=8058"},"modified":"2019-08-11T08:55:14","modified_gmt":"2019-08-10T23:55:14","slug":"excel-vba-%e3%81%a7%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%ae%e3%82%aa%e3%83%bc%e3%83%88%e3%83%95%e3%82%a3%e3%83%ab%e3%82%bf%e3%83%bc%e7%b5%90%e6%9e%9c%e3%82%92%e5%8f%96%e5%be%97%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=8058","title":{"rendered":"EXCEL VBA \u3067\u30c6\u30fc\u30d6\u30eb\u306e\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<div class=\"theContentWrap-ccc\">\n<p>\u3000EXCEL \u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u633f\u5165\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\uff0e\u3053\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u304b\u3051\u305f\u7d50\u679c\u3092 VBA \u3067\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u96e3\u89e3\u3067\uff0c\u5f93\u6765\u306e\u8003\u3048\u65b9\u3068\u306f\u5c11\u3057\u7570\u306a\u308a\u307e\u3059\uff0e<\/p>\n<p>\u3000\u3088\u308a\u62bd\u8c61\u5ea6\u306e\u9ad8\u3044\u8003\u3048\u65b9\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff0e\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u6982\u5ff5\u3067\u3042\u308b\u96c6\u5408\u8ad6\u3092\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff0e<\/p>\n<p><!--more--><\/p>\n<h3>\u30c6\u30fc\u30d6\u30eb=ListObject\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h3>\n<p>\u3000\u30c6\u30fc\u30d6\u30eb\u306e\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f ListObject \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff0e<a href=\"http:\/\/officetanaka.net\/excel\/vba\/table\/01.htm\" target=\"_blank\" rel=\"noopener noreferrer\">\u30bb\u30eb\u7bc4\u56f2\u3092\u30c6\u30fc\u30d6\u30eb\u306b\u3059\u308b(OfficeTanaka)<\/a>\u306b\u8a73\u7d30\u304c\u3042\u308a\u307e\u3059\u304c\uff0cListObject \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30c6\u30fc\u30d6\u30eb\u3092\u8868\u3057\u3066\u304a\u308a\uff0c\u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3067\u3059\uff0e\u307e\u305f\u4f5c\u6210\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u540d\u524d\u304c\u81ea\u52d5\u7684\u306b\u3064\u304d\u307e\u3059\uff0e<\/p>\n<h3>\u30c6\u30fc\u30d6\u30eb\u306e\u633f\u5165<\/h3>\n<p>\u3000\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u633f\u5165\u3059\u308b\u306b\u306f\u300c\u633f\u5165\u300d\u30bf\u30d6\u306e\u300c\u30c6\u30fc\u30d6\u30eb\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\uff0e<\/p>\n<pre class=\"lang:vbnet decode:true \" title=\"\u30c6\u30fc\u30d6\u30eb\u306e\u633f\u5165\">ActiveSheet.ListObjects.Add xlSrcRange, Range(\"A1\").CurrentRegion<\/pre>\n<figure id=\"attachment_8062\" aria-describedby=\"caption-attachment-8062\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/00.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8062\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/00-300x266.png\" alt=\"\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u30bb\u30eb\u7bc4\u56f2\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u633f\u5165\u3059\u308b\" width=\"300\" height=\"266\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/00-300x266.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/00.png 325w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8062\" class=\"wp-caption-text\">\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u30bb\u30eb\u7bc4\u56f2\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u633f\u5165\u3059\u308b<\/figcaption><\/figure>\n<h3>\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u3066\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u3000EXCEL \u3067\u4f5c\u696d\u3057\u3066\u3044\u308b\u3068\u6c17\u304c\u3064\u304b\u306a\u3044\u3053\u3068\u3082\u3042\u308b\u306e\u3067\u3059\u304c\uff0c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u3068\u3044\u3046\u3082\u306e\u304c\u5b58\u5728\u3059\u308b\u3053\u3068\u306b\u6c17\u304c\u3064\u304d\u307e\u3059\uff0e<\/p>\n<p>\u3000\u4eca\u56de\u306f\u5b9f\u4f5c\u696d\u306b\u5165\u308b\u524d\u306b\uff0c\u4f5c\u696d\u7528\u30c7\u30fc\u30bf\u306e\u5165\u3063\u305f\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u3066\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\uff0e<\/p>\n<p>\u3000\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\uff0e\u300c\u30c6\u30fc\u30d6\u30eb\u30c7\u30b6\u30a4\u30f3\u300d\u30bf\u30d6\u306e\u300c\u30c4\u30fc\u30eb\u300d\u306e\u300c\u91cd\u8907\u306e\u524a\u9664\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\uff0e<\/p>\n<figure id=\"attachment_8063\" aria-describedby=\"caption-attachment-8063\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8063\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-1-300x52.png\" alt=\"\u300c\u30c6\u30fc\u30d6\u30eb\u30c7\u30b6\u30a4\u30f3\u300d\u306e\u300c\u30c4\u30fc\u30eb\u300d\u306b\u3042\u308b\u300c\u91cd\u8907\u306e\u524a\u9664\u300d\" width=\"300\" height=\"52\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-1-300x52.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-1.png 751w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8063\" class=\"wp-caption-text\">\u300c\u30c6\u30fc\u30d6\u30eb\u30c7\u30b6\u30a4\u30f3\u300d\u306e\u300c\u30c4\u30fc\u30eb\u300d\u306b\u3042\u308b\u300c\u91cd\u8907\u306e\u524a\u9664\u300d<\/figcaption><\/figure>\n<p>\u3000\u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u521d\u671f\u72b6\u614b\u3067\u3059\uff0e\u5168\u3066\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u30c1\u30a7\u30c3\u30af\u304c\u5165\u3063\u3066\u3044\u307e\u3059\uff0e<\/p>\n<figure id=\"attachment_8064\" aria-describedby=\"caption-attachment-8064\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/02-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8064\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/02-1-300x167.png\" alt=\"\u300c\u91cd\u8907\u306e\u524a\u9664\u300d\u306e\u521d\u671f\u72b6\u614b\" width=\"300\" height=\"167\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/02-1-300x167.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/02-1.png 524w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8064\" class=\"wp-caption-text\">\u300c\u91cd\u8907\u306e\u524a\u9664\u300d\u306e\u521d\u671f\u72b6\u614b<\/figcaption><\/figure>\n<p>\u3000\u4e3b\u30ad\u30fc\u3067\u3042\u308b City_Code \u306e\u307f\u30c1\u30a7\u30c3\u30af\u3057\u3066OK\u3057\u307e\u3059\uff0e<\/p>\n<figure id=\"attachment_8065\" aria-describedby=\"caption-attachment-8065\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8065\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/03-300x167.png\" alt=\"\u300c\u3059\u3079\u3066\u9078\u629e\u89e3\u9664\u300d\u3057\u3066\u30ad\u30fc\u3067\u3042\u308b\u300cCity_Code\u300d\u3092\u30c1\u30a7\u30c3\u30af\" width=\"300\" height=\"167\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/03-300x167.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/03.png 524w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8065\" class=\"wp-caption-text\">\u300c\u3059\u3079\u3066\u9078\u629e\u89e3\u9664\u300d\u3057\u3066\u30ad\u30fc\u3067\u3042\u308b\u300cCity_Code\u300d\u3092\u30c1\u30a7\u30c3\u30af<\/figcaption><\/figure>\n<p>\u3000\u4e0d\u8981\u306a\u5217\u3092\u524a\u9664\u3057\uff0cCity_Code, City_Type, Prefecture_Code, Prefectures, City \u306e5\u5217\u3092\u6b8b\u3057\u307e\u3059\uff0e<\/p>\n<figure id=\"attachment_8066\" aria-describedby=\"caption-attachment-8066\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/04-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8066\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/04-1-300x193.png\" alt=\"\u4e0d\u8981\u306a\u5217\u3092\u524a\u9664\u3057\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u3068\u3059\u308b\" width=\"300\" height=\"193\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/04-1-300x193.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/04-1.png 662w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8066\" class=\"wp-caption-text\">\u4e0d\u8981\u306a\u5217\u3092\u524a\u9664\u3057\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u3068\u3059\u308b<\/figcaption><\/figure>\n<pre class=\"lang:vbnet decode:true \" title=\"\u91cd\u8907\u524a\u9664\">ActiveSheet.Range(\"\u30c6\u30fc\u30d6\u30eb22[#\u3059\u3079\u3066]\").RemoveDuplicates Columns:=3, Header:=xlYes<\/pre>\n<p>\u3000\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u306e\u5165\u3063\u3066\u3044\u308b\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u540d\u3092 CITY_CODE \u3068\u3057\u307e\u3059\uff0e\u307e\u305f\uff0c\u5143\u306e\u30c7\u30fc\u30bf\u306e\u5165\u3063\u3066\u3044\u308b\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u540d\u3092 DATA \u3068\u3057\u307e\u3059\uff0e<\/p>\n<h3>\u6563\u5e03\u56f3\u306e\u30c7\u30fc\u30bf\u7cfb\u5217\u306b\u306f\u300c\u7cfb\u5217\u540d\u300d\u300c\u7cfb\u5217X\u306e\u5024\u300d\u300c\u7cfb\u5217Y\u306e\u5024\u300d\u304c\u5fc5\u8981<\/h3>\n<p>\u3000\u56f3\u3092\u898b\u308b\u3068\u5206\u304b\u308a\u307e\u3059\u304c\uff0c\u6563\u5e03\u56f3\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u9078\u629e\u306b\u304a\u3044\u3066\u306f\u30c7\u30fc\u30bf\u7cfb\u5217\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff0e<\/p>\n<p>\u3000\u30c7\u30fc\u30bf\u7cfb\u5217\u306b\u5fc5\u8981\u306a\u306e\u306f\u300c\u7cfb\u5217\u540d\u300d\u300c\u7cfb\u5217X\u306e\u5024\u300d\u300c\u7cfb\u5217Y\u306e\u5024\u300d\u3067\u3059\uff0e<\/p>\n<p>\u3000\u300c\u7cfb\u5217\u540d\u300d\u306f\u30c7\u30fc\u30bf\u7cfb\u5217\u304c\u4e00\u500b\u306e\u5834\u5408\u306f\u30b0\u30e9\u30d5\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u306a\u308a\uff0c\u8907\u6570\u306e\u5834\u5408\u306b\u306f\u51e1\u4f8b\u306b\u306a\u308a\u307e\u3059\uff0e<\/p>\n<p>\u3000\u300c\u7cfb\u5217X\u306e\u5024\u300d\u3068\u300c\u7cfb\u5217Y\u306e\u5024\u300d\u306f\u305d\u308c\u305e\u308c\u6563\u5e03\u56f3\u4e0a\u306e\u5ea7\u6a19\u306e (X, Y) \u306e\u5024\u306b\u76f8\u5f53\u3057\uff0c\u901a\u5e38\u30da\u30a2\u3092\u306a\u3057\u3066\u3044\u307e\u3059\uff0e\u901a\u5e38\u306f\u5bfe\u5fdc\u3059\u308b\u540c\u3058\u5927\u304d\u3055\u306e\u30bb\u30eb\u7bc4\u56f2\uff0c\u3064\u307e\u308a\u914d\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\uff0e<\/p>\n<p>\u3000\u307e\u305f\uff0c\u30c7\u30fc\u30bf\u7cfb\u5217\u306f\u8907\u6570\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff0e<\/p>\n<figure id=\"attachment_8015\" aria-describedby=\"caption-attachment-8015\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-8015\" src=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-300x194.png\" alt=\"\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u9078\u629e\u300d\u306e\u300c\u7cfb\u5217\u306e\u7de8\u96c6\u300d\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01-300x194.png 300w, https:\/\/www.fujiitoshiki.com\/improvesociety\/wp-content\/uploads\/01.png 651w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-8015\" class=\"wp-caption-text\">\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u9078\u629e\u300d\u306e\u300c\u7cfb\u5217\u306e\u7de8\u96c6\u300d<\/figcaption><\/figure>\n<p>\u3000\u3053\u3053\u304b\u3089\uff0c\u300c\u7cfb\u5217X\u306e\u5024\u300d\u3068\u300c\u7cfb\u5217Y\u306e\u5024\u300d\u306b\u306f VBA \u4e0a\u3067\u914d\u5217\u3092\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306a\u306e\u3067\u306f\u306a\u3044\u304b\uff1f\u3068\u3044\u3046\u63a8\u6e2c\u304c\u6210\u308a\u7acb\u3061\u307e\u3059\uff0e\u4eca\u56de\u306f\u3053\u306e\u4eee\u8a2d\u3092\u691c\u8a3c\u3057\u307e\u3057\u3087\u3046\uff0e<\/p>\n<h3>\u51e6\u7406\u306e\u6d41\u308c<\/h3>\n<h4>\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u306e\u30ad\u30fc\u3092\u30eb\u30fc\u30d7\u3059\u308b<\/h4>\n<p>\u300020 \u884c\u76ee\u304b\u3089 21 \u884c\u76ee\u3067\u30de\u30b9\u30bf\u30fc\u30c6\u30fc\u30d6\u30eb\u306e\u30bb\u30eb\u7bc4\u56f2\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\uff0e\u3053\u306e\u7bc4\u56f2\u3092\u4e00\u500b\u305a\u3064\u30eb\u30fc\u30d7\uff0824 \u884c\u76ee\u3068 47 \u884c\u76ee\uff09\u3057\u3066\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u30ad\u30fc\u3068\u3057\u307e\u3059\uff0e<\/p>\n<h4>\u30c7\u30fc\u30bf\u30c6\u30fc\u30d6\u30eb\u3092\u30ad\u30fc\u3067\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3059\u308b<\/h4>\n<p>\u3000\u30ef\u30fc\u30af\u30b7\u30fc\u30c8 DATA \u306b\u3042\u308b\u30c6\u30fc\u30d6\u30eb\uff0825 \u884c\u76ee\u3068 43 \u884c\u76ee\uff09\u306b\u5bfe\u3057\u3066\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u304b\u3051\u307e\u3059\uff0826 \u884c\u76ee\uff09\uff0e41 \u884c\u76ee\u3067\u3044\u3063\u305f\u3093\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u89e3\u9664\u3057\u307e\u3059\uff0e<\/p>\n<h4>\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b<\/h4>\n<p>\u3000\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u5f93\u6765\u3068\u306f\u7570\u306a\u308a\uff0cListObject \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff0e<\/p>\n<p>\u3000<a href=\"http:\/\/officetanaka.net\/excel\/vba\/table\/06.htm\" target=\"_blank\" rel=\"noopener noreferrer\">\u30c8\u30ea\u30c3\u30ad\u30fc\u306a\u65b9\u6cd5<\/a>\u3067\u3059\u304c\uff0c .SpecialCells (xlCellTypeVisible) \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u7528\u3044\u308b\u306e\u304c\u78ba\u5b9f\u3067\u3059\uff0e\u30bf\u30a4\u30c8\u30eb\u884c\u3082\u53d6\u5f97\u3055\u308c\u308b\u305f\u3081\uff0c.DataBodyRange \u3068\u306e\u8ad6\u7406\u7a4d\u3092\u53d6\u3063\u3066\u30c7\u30fc\u30bf\u3060\u3051\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\uff0827 \u884c\u76ee\uff09\uff0e<\/p>\n<h4>\u53d6\u5f97\u3057\u305f\u5024\u3092\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b<\/h4>\n<p>\u3000\u52d5\u7684\u914d\u5217\u3092\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u521d\u671f\u5316\u3057\uff0c\u914d\u5217 myXValue(), myValue() \u306b\u683c\u7d0d\u3057\u307e\u3059\uff0830 \u884c\u76ee\u304b\u3089 36 \u884c\u76ee\uff09\uff0e\u3053\u306e\u914d\u5217\u306f\u4f7f\u3044\u56de\u3059\u305f\u3081\uff0829 \u884c\u76ee\uff0c39 \u884c\u76ee\uff09\uff0c\u5024\u306e\u4fdd\u6301\u306f\u884c\u3044\u307e\u305b\u3093\uff0e<\/p>\n<h4>Debug.Print \u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53d6\u5f97\u3084\u914d\u5217\u3078\u306e\u683c\u7d0d\u3092\u78ba\u8a8d\u3059\u308b<\/h4>\n<p>\u3000\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u305f Debug.Print \u306f Range \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\uff0c\u914d\u5217\u306b\u5024\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u7528\u3067\u3059\uff0828 \u884c\u76ee\uff0c37 \u884c\u76ee\uff09\uff0e<\/p>\n<h4>\u914d\u5217\u3092\u30c7\u30fc\u30bf\u7cfb\u5217\u306b\u6e21\u3059\u51e6\u7406<\/h4>\n<p>\u3000\u52d5\u7684\u914d\u5217\u306b\u683c\u7d0d\u3055\u308c\u305f\u5024\u3092\u6563\u5e03\u56f3\u306e\u30c7\u30fc\u30bf\u7cfb\u5217\u306b\u6e21\u3059\u51e6\u7406\u306f 40 \u884c\u76ee\u306b\u66f8\u304d\u307e\u3059\uff0e\u4eca\u56de\u306f\u305d\u3053\u307e\u3067\u884c\u3044\u307e\u305b\u3093\uff0e\u5f8c\u65e5\u78ba\u8a8d\u3057\u3066\u304b\u3089\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3059\uff0e<\/p>\n<pre class=\"lang:vbnet decode:true\">Sub GetDataSeries()\n\nDim mySht1  As Worksheet\nDim mySht2  As Worksheet\n\nDim myRng1  As Range\nDim myRng2  As Range\nDim myRng3  As Range\n\nDim myName  As String\nDim myXValue()  As Double\nDim myValue()   As Long\nDim i           As Integer\nDim j           As Integer\n\n\nSet mySht1 = Worksheets(\"CITY_CODE\")\nSet mySht2 = Worksheets(\"DATA\")\n\nSet myRng1 = Intersect(mySht1.UsedRange, mySht1.Range(\"A:A\"))\nSet myRng1 = myRng1.Resize(myRng1.Rows.Count - 1).Offset(1)\n\ni = 1\nFor Each myRng2 In myRng1\n    With mySht2.ListObjects(\"\u30c6\u30fc\u30d6\u30eb2\").Range\n        .AutoFilter Field:=3, Criteria1:=myRng2.Value\n        Set myRng3 = Intersect(.SpecialCells(xlCellTypeVisible), mySht2.ListObjects(\"\u30c6\u30fc\u30d6\u30eb2\").DataBodyRange)\n        'Debug.Print i, myRng3.Address\n        For j = 0 To myRng3.Rows.Count - 1\n            ReDim myXValue(j)\n            ReDim myValue(j)\n            'Debug.Print i, j\n            \n            myName = myRng3.Cells(j + 1, 6)\n            myXValue(j) = myRng3.Cells(j + 1, 10)\n            myValue(j) = myRng3.Cells(j + 1, 7)\n            'Debug.Print myName, myXValue(j), myValue(j)\n            \n        Next j\n        \n        .AutoFilter Field:=3\n        \n    End With\n    \n    i = i + 1\n    \nNext myRng2\n\nEnd Sub<\/pre>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u3000EXCEL VBA \u3067\u30c6\u30fc\u30d6\u30eb\u306e\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3057\u305f\uff0e<\/p>\n<p>\u3000\u5f93\u6765\u306e\u624b\u7d9a\u304d\u578b\u30d9\u30fc\u30b9\u306e\u8003\u3048\u65b9\u3067\u306f\u306a\u304f\uff0c\u96c6\u5408\u30d9\u30fc\u30b9\u306e\u8003\u3048\u65b9\u304c\u8981\u6c42\u3055\u308c\u3066\u3044\u307e\u3059\uff0e\u7279\u306b ListObject \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30e1\u30f3\u30d0\u306f\u8208\u5473\u6df1\u3044\u5185\u5bb9\u3067\u3059\uff0e<\/p>\n<p>\u3000\u6700\u8fd1\u306e EXCEL \u306f PowerQuery \u306a\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30bd\u30d5\u30c8\u306a\u3069\u3068\u306e\u9023\u643a\u3092\u91cd\u8996\u3057\u3066\u3044\u308b\u3088\u3046\u3067\uff0cSQL Server \u30c1\u30fc\u30e0\u3068\u306e\u5171\u540c\u4f5c\u696d\u3092\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff0e<\/p>\n<p>\u3000\u30c6\u30fc\u30d6\u30eb\u3092\u6271\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u95a2\u3057\u3066\u3082\u305d\u306e\u5f71\u97ff\u304c\u51fa\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\uff0e<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u3000EXCEL \u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u633f\u5165\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\uff0e\u3053\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u304b\u3051\u305f\u7d50\u679c\u3092 VBA \u3067\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u96e3\u89e3\u3067\uff0c\u5f93\u6765\u306e\u8003\u3048\u65b9\u3068\u306f\u5c11\u3057\u7570\u306a\u308a\u307e\u3059\uff0e \u3000 &hellip; <a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=8058\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;EXCEL VBA \u3067\u30c6\u30fc\u30d6\u30eb\u306e\u30aa\u30fc\u30c8\u30d5\u30a3\u30eb\u30bf\u30fc\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"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":[814,819,603,793,823,820,821,811,136,153,812,794,784,797,807,813,802,783,705,683,798,791,782,787,803,818,808,817,801,816,786,796,809,822,790,788,684,805,806,804,785,795,810,815,310,800,799,792],"class_list":["post-8058","post","type-post","status-publish","format-standard","hentry","category-excel","tag-databodyrange","tag-debug","tag-excel","tag-listobject","tag-powerquery","tag-print","tag-range","tag-specialcells","tag-sql-server","tag-vba","tag-xlcelltypevisible","tag-794","tag-784","tag-797","tag-807","tag-813","tag-802","tag-783","tag-705","tag-683","tag-798","tag-791","tag-782","tag-787","tag-803","tag-818","tag-808","tag-817","tag-801","tag-816","tag-786","tag-796","tag-809","tag-822","tag-790","tag-788","tag-684","tag-x","tag-y","tag-804","tag-785","tag-795","tag-810","tag-815","tag-310","tag-800","tag-799","tag-792"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/8058","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=8058"}],"version-history":[{"count":25,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/8058\/revisions"}],"predecessor-version":[{"id":8129,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/8058\/revisions\/8129"}],"wp:attachment":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}