{"id":6456,"date":"2017-10-12T07:54:01","date_gmt":"2017-10-11T22:54:01","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=6456"},"modified":"2017-10-23T12:47:31","modified_gmt":"2017-10-23T03:47:31","slug":"vbadictionary","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/vbadictionary\/","title":{"rendered":"\u9023\u60f3\u914d\u5217\uff08Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09"},"content":{"rendered":"<h2>\u9023\u60f3\u914d\u5217<\/h2>\n<div class=\"m30-l\">\n<p>\u9023\u60f3\u914d\u5217\u3068\u306f\u3001\u6dfb\u5b57\uff08\u30ad\u30fc\uff09\u306b\u6587\u5b57\u5217\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u914d\u5217\u3067\u3059\u3002<br \/>\n    VBA \u3067\u3001\u9023\u60f3\u914d\u5217\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001<strong>CreateObject \u95a2\u6570<\/strong>\u306e\u5f15\u6570\u306b\u300cScripting.Dictionary\u300d\u3092\u6307\u5b9a\u3059\u308b\u304b\u3001\u53c2\u7167\u8a2d\u5b9a\u300cMicrosoft Scripting Runtime\u300d\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\uff08\u203b\u3000<a href=\"https:\/\/excelwork.info\/excel\/collection\/\">\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\uff08Collection\uff09\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a> \u3092\u7c21\u5358\u306a\u9023\u60f3\u914d\u5217\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002\uff09<\/p>\n<br \/>\n<h3>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1cCreateObject \u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\uff1e<\/strong><\/span><br \/>\n    <b>Dim<\/b> <em>myDic<\/em> <b>As Object<\/b><br \/>\n    <b>Set<\/b> <em>myDic<\/em> = <b>CreateObject(&#8220;Scripting.Dictionary&#8221;)<\/b><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53c2\u7167\u8a2d\u5b9a\u3092\u884c\u3046\u5834\u5408\uff1e<\/strong><\/span><br \/>\n    <b>Dim<\/b> <em>myDic<\/em> <b>As Dictionary<\/b><br \/>\n    <b>Set<\/b> <em>myDic<\/em> = <b>New Dictionary<\/b><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>myDic&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Add \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306b\u65b0\u898f\u306e\u300c\u30ad\u30fc\u300d\u3068\u300c\u5024\u300d\u306e\u30bb\u30c3\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<b>Add<\/b> <em>key<\/em>, <em>item<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>key&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u8ffd\u52a0\u3059\u308b\u300c\u30ad\u30fc\u300d\u3068\u306a\u308b\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>item&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u8ffd\u52a0\u3059\u308b\u300c\u5024\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Exists \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u300c\u30ad\u30fc\u300d\u304c\u3001\u9023\u60f3\u914d\u5217\u306b\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>bool<\/em> = <em>object<\/em>.<b>Exists<\/b> <em>key<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>key&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u691c\u7d22\u3059\u308b\u300c\u30ad\u30fc\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u9023\u60f3\u914d\u5217\u306b\u5b58\u5728\u3059\u308b\u5834\u5408\u306f\u3001<strong>True<\/strong> \u3001\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\u3001<strong>False<\/strong> \u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Items \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u300c\u5024\u300d\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>array<\/em> = <em>object<\/em>.<b>Items<\/b><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>array&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u9023\u60f3\u914d\u5217\u306e\u300c\u5024\u300d\u306e\u307f\u3092\u914d\u5217\u3068\u3057\u3066\u53d6\u5f97\u3057\u305f\u3082\u306e<br \/>\n\t\uff08\u4f8b\uff09\u9023\u60f3\u914d\u5217 orgArray<br \/>\n\torgArray(&#8220;first&#8221;) = 100\u3001orgArray(&#8220;second&#8221;) = 150\u3001orgArray(&#8220;third&#8221;) = 200 \u306e\u5834\u5408\u3001<br \/>\n\tarray(0) = 100\u3001array(1) = 150\u3001array(3) = 200<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Keys \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u300c\u30ad\u30fc\u300d\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>array<\/em> = <em>object<\/em>.<b>Keys<\/b><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>array&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u9023\u60f3\u914d\u5217\u306e\u300c\u30ad\u30fc\u300d\u306e\u307f\u3092\u914d\u5217\u3068\u3057\u3066\u53d6\u5f97\u3057\u305f\u3082\u306e<br \/>\n\t\uff08\u4f8b\uff09\u9023\u60f3\u914d\u5217 orgArray<br \/>\n\torgArray(&#8220;first&#8221;) = 100\u3001orgArray(&#8220;second&#8221;) = 150\u3001orgArray(&#8220;third&#8221;) = 200 \u306e\u5834\u5408\u3001<br \/>\n\tarray(0) = &#8220;first&#8221;\u3001array(1) = &#8220;second&#8221;\u3001array(3) = &#8220;third&#8221;<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Remove \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306e\u300c\u30ad\u30fc\u300d\u3068\u300c\u5024\u300d\u306e\u30bb\u30c3\u30c8\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<b>Remove<\/b> <em>key<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>key&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u524a\u9664\u3059\u308b\u300c\u30ad\u30fc\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u300c\u30ad\u30fc\u300d\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>RemoveAll \u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u300c\u30ad\u30fc\u300d\u3068\u300c\u5024\u300d\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<b>RemoveAll<\/b><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Count \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u306e\u9805\u76ee\u6570\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<b>Count<\/b><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Item \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u3067\u3001\u300c\u30ad\u30fc\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u300c\u5024\u300d\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u307e\u305f\u306f\u3001\u9023\u60f3\u914d\u5217\u306b\u65b0\u898f\u306e\u300c\u30ad\u30fc\u300d\u3068\u300c\u5024\u300d\u306e\u30bb\u30c3\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>value<\/em> = <em>object<\/em>[ .<b>Item<\/b> ](<em>key<\/em>)<\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u8a2d\u5b9a\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>[ .<b>Item<\/b> ](<em>key<\/em>) = <em>newitem<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>key&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u53d6\u5f97\u307e\u305f\u306f\u8a2d\u5b9a\u3059\u308b\u9805\u76ee\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u300c\u30ad\u30fc\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>newitem&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u300c\u30ad\u30fc\u300d\uff08<em>key<\/em>\uff09\u306b\u95a2\u9023\u4ed8\u3051\u308b\u300c\u5024\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<br \/>\n<h3>Key \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u300c\u30ad\u30fc\u300d\u3092\u65b0\u3057\u3044\u300c\u30ad\u30fc\u300d\u306b\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u8a2d\u5b9a\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<b>Key<\/b>(<em>key<\/em>) =  <em>newkey<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>key&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5909\u66f4\u3059\u308b\u300c\u30ad\u30fc\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>newkey&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<em>key<\/em> \u3067\u6307\u5b9a\u3057\u305f\u300c\u30ad\u30fc\u300d\u3068\u7f6e\u304d\u63db\u3048\u308b\u65b0\u898f\u306e\u300c\u30ad\u30fc\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<\/div>\n<br \/><br \/>\n<h2>VBA \u3067\u3001\u9023\u60f3\u914d\u5217\u3092\u4f7f\u7528\u3059\u308b\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9\uff11<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u9023\u60f3\u914d\u5217 \u4f7f\u7528\u4f8b\uff08\u91cd\u8907\u524a\u9664\uff09\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_Dictionary1()\r\n\r\n    '\u91cd\u8907\u3092\u524a\u9664\u3057\u3066\u8868\u793a\u3059\u308b\r\n    \r\n    Dim myDic As Object\r\n    Dim myKey As Variant\r\n    Dim myRng As Range\r\n    Dim i As Long\r\n    Dim c As Variant\r\n    Dim v As Variant\r\n    Dim myStr As String\r\n    \r\n    Set myDic = CreateObject(\"Scripting.Dictionary\")\r\n    \r\n    With Worksheets(\"Sheet1\")\r\n    \r\n        Set myRng = Range(\"A1\").CurrentRegion\r\n        \r\n        For Each c In myRng\r\n            myKey = c.Value\r\n            If Not myDic.Exists(myKey) Then\r\n                myDic.Add myKey, \"\"\r\n            End If\r\n        Next c\r\n        \r\n        i = 1\r\n        For Each v In myDic.Keys\r\n            myStr = myStr & i & vbTab & v & vbCrLf\r\n            i = i + 1\r\n        Next v\r\n    \r\n    End With\r\n    \r\n    MsgBox myStr\r\n    \r\n    Set myDic = Nothing\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_01.jpg?ssl=1\" rel=\"lightbox[6456]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_01.jpg?resize=534%2C515&#038;ssl=1\" alt=\"Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3000\u4f7f\u7528\u4f8b\uff11\" width=\"534\" height=\"515\" class=\"alignnone size-full wp-image-6466\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_01.jpg?w=534&amp;ssl=1 534w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_01.jpg?resize=400%2C386&amp;ssl=1 400w\" sizes=\"(max-width: 534px) 100vw, 534px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9\uff12<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u9023\u60f3\u914d\u5217 \u4f7f\u7528\u4f8b\uff08\u91cd\u8907\u524a\u9664\uff09\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_Dictionary2()\r\n\r\n    '\u53c2\u7167\u8a2d\u5b9a\u300cMicrosoft Scripting Runtime\u300d\r\n    '\u91cd\u8907\u3057\u305f\u30c7\u30fc\u30bf\u306e\u5024\u3092\u5408\u8a08\u3057\u3066\u8868\u793a\r\n    \r\n    Dim myDic As Dictionary\r\n    Dim myKey As Variant\r\n    Dim i As Long\r\n    Dim v As Variant\r\n    Dim myStr As String\r\n    \r\n    Set myDic = New Dictionary\r\n    \r\n    With Worksheets(\"Sheet2\")\r\n        For i = 1 To .Cells(.Cells.Rows.Count, 1).End(xlUp).Row\r\n            myKey = Cells(i, 1).Value\r\n            If myDic.Exists(myKey) Then\r\n                myDic(myKey) = myDic(myKey) + .Cells(i, 2)\r\n            Else\r\n                myDic.Add myKey, .Cells(i, 2)\r\n            End If\r\n        Next i\r\n        i = 1\r\n        For i = 1 To myDic.Count\r\n            myStr = myStr & myDic.Keys(i - 1) & vbTab & _\r\n                            myDic.Items(i - 1) & vbCrLf     '\u2190 myDic (myDic.Keys(i - 1)) & vbCrLf \u3067\u3082\u3088\u3044\r\n        Next i\r\n    End With\r\n\r\n    MsgBox myStr\r\n    \r\n    Set myDic = Nothing\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_02.jpg?ssl=1\" rel=\"lightbox[6456]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_02.jpg?resize=536%2C394&#038;ssl=1\" alt=\"Dictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3000\u4f7f\u7528\u4f8b\uff12\" width=\"536\" height=\"394\" class=\"alignnone size-full wp-image-6467\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_02.jpg?w=536&amp;ssl=1 536w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_02.jpg?resize=400%2C294&amp;ssl=1 400w\" sizes=\"(max-width: 536px) 100vw, 536px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u9023\u60f3\u914d\u5217 \u9023\u60f3\u914d\u5217\u3068\u306f\u3001\u6dfb\u5b57\uff08\u30ad\u30fc\uff09\u306b\u6587\u5b57\u5217\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u914d\u5217\u3067\u3059\u3002 V &#8230; <\/p>\n","protected":false},"author":1,"featured_media":6466,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[37],"tags":[1033,954,63,955,81],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/10\/dictionary_01.jpg?fit=534%2C515&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1G8","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6456"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=6456"}],"version-history":[{"count":8,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6456\/revisions"}],"predecessor-version":[{"id":6478,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6456\/revisions\/6478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/6466"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=6456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=6456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=6456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}