{"id":4104,"date":"2023-08-26T12:00:01","date_gmt":"2023-08-26T03:00:01","guid":{"rendered":"https:\/\/www.bold.ne.jp\/engineer-club\/?p=4104"},"modified":"2025-12-19T11:19:43","modified_gmt":"2025-12-19T02:19:43","slug":"vba-dictionary","status":"publish","type":"post","link":"https:\/\/www.bold.ne.jp\/engineer-club\/vba-dictionary","title":{"rendered":"VBA\u306eDictionary\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306f\uff1f\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3092\u5177\u4f53\u4f8b\u3068\u3068\u3082\u306b\u89e3\u8aac"},"content":{"rendered":"<p>VBA\u3067\u306f\u3001\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u6642\u306b\u914d\u5217\u3092\u3088\u304f\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\n<span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u3088\u3046\u306b\u30ad\u30fc\u30ef\u30fc\u30c9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#VBADictionary\">\uff11\uff0eVBA\u306eDictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3064\u3044\u3066<\/a><ul><li><a href=\"#-Dictionary\">\uff11-\uff11\uff0eDictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306f<\/a><\/li><li><a href=\"#-Runtime\">\uff11-\uff12\uff0eRuntime\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u8a2d\u5b9a<\/a><\/li><li><a href=\"#-Dictionary-2\">\uff11-\uff13\uff0eDictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u6587<\/a><\/li><\/ul><\/li><li><a href=\"#Dictionary\">\uff12\uff0eDictionary\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u7279\u6b8a\u306a\u4f7f\u3044\u65b9<\/a><ul><li><a href=\"#-Key\">\uff12-\uff11\uff0e\u91cd\u8907\u3059\u308bKey\u3092\u53d6\u308a\u8fbc\u307e\u306a\u3044<\/a><\/li><li><a href=\"#i\">\uff12-\uff12\uff0e\u8a2d\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#Dictionary-2\">\uff13\uff0eDictionary\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u305d\u306e\u4ed6\u306e\u4f7f\u7528\u4f8b<\/a><ul><li><a href=\"#-Excel\">\uff13-\uff11\uff0e\u9023\u60f3\u914d\u5217\u306b\u8ffd\u52a0\u3059\u308b\u30c7\u30fc\u30bf\u3092\u3001Excel\u306e\u30bb\u30eb\u304b\u3089\u53d6\u5f97<\/a><\/li><\/ul><\/li><li><a href=\"#i-2\">\uff14\uff0e\u6700\u5f8c\u306b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"VBADictionary\"><span>\uff11\uff0eVBA\u306eDictionary <\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3064\u3044\u3066<\/span><\/h2>\n<h3><span id=\"-Dictionary\"><span>\uff11-\uff11\uff0eDictionary <\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306f<\/span><\/h3>\n<p><span>Dictionary<\/span>\uff08\u8f9e\u66f8\uff09\u306e\u540d\u306e\u901a\u308a\u3001<span>Key<\/span>\uff08\u30ad\u30fc\u30ef\u30fc\u30c9\uff09\u3068<span>Item<\/span>\uff08\u30c7\u30fc\u30bf\uff09\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<span>Key<\/span>\u306f\u91cd\u8907\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<span>Key<\/span>\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001<span>Item<\/span>\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3><span id=\"-Runtime\"><span>\uff11-\uff12\uff0eRuntime<\/span>\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u8a2d\u5b9a<\/span><\/h3>\n<p><span>Runtime<\/span>\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u4e8b\u524d\u306b\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h4><span>\uff11-\uff12-\uff11\uff0e<\/span>\u8a2d\u5b9a\u65b9\u6cd5<\/h4>\n<p>\u30e1\u30cb\u30e5\u30fc\u306e<span>[<\/span>\u30c4\u30fc\u30eb<span>]<\/span>\u2192<span>[<\/span>\u53c2\u7167\u8a2d\u5b9a<span>]<\/span>\u3092\u9078\u629e<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u30e1\u30cb\u30e5\u30fc\u306e\u30c4\u30fc\u30eb\u2192\u53c2\u7167\u8a2d\u5b9a\u3092\u9078\u629e.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u30e1\u30cb\u30e5\u30fc\u306e\u30c4\u30fc\u30eb\u2192\u53c2\u7167\u8a2d\u5b9a\u3092\u9078\u629e.png\" alt=\"\u30e1\u30cb\u30e5\u30fc\u306e[\u30c4\u30fc\u30eb]\u2192[\u53c2\u7167\u8a2d\u5b9a]\u3092\u9078\u629e\" width=\"280\" height=\"205\" class=\"alignnone size-full wp-image-4107\" \/><\/a><\/p>\n<p>\u53c2\u7167\u53ef\u80fd\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u300c<span>Microsoft Scripting Runtime<\/span>\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066\u300c<span>OK<\/span>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u53c2\u7167\u53ef\u80fd\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u300cMicrosoft-Scripting-Runtime\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u53c2\u7167\u53ef\u80fd\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u300cMicrosoft-Scripting-Runtime\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066.png\" alt=\"\u53c2\u7167\u53ef\u80fd\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u300cMicrosoft Scripting Runtime\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066\u300cOK\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\" width=\"520\" height=\"395\" class=\"alignnone size-full wp-image-4108\" \/><\/a><\/p>\n<h3><span id=\"-Dictionary-2\">\uff11-\uff13\uff0e<span>Dictionary <\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u6587<\/span><\/h3>\n<p><span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u3001<span>Runtime<\/span>\u3092\u4f7f\u3046\u65b9\u6cd5\u3068\u4f7f\u308f\u306a\u3044\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u4f7f\u3046\u5834\u5408\u3068\u4f7f\u308f\u306a\u3044\u5834\u5408\u3067\u3001\u8a18\u8ff0\u65b9\u6cd5\u304c\u7570\u306a\u308b\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u3001\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h4><span>\uff11-\uff13-\uff11\uff0eRuntime<\/span>\u3092\u4f7f\u3046\u5834\u5408<\/h4>\n<h5><span>\uff11-\uff13-\uff11-\uff11\uff0e<\/span>\u9023\u60f3\u914d\u5217\u306e\u5b9a\u7fa9\u65b9\u6cd5<\/h5>\n<pre class=\"prettyprint lang:default decode:true\">'\u9023\u60f3\u914d\u5217\u3092Object\u578b\u3067\u5b9a\u7fa9\u3001\r\nDim [\u9023\u60f3\u914d\u5217\u540d] As Dictionary\r\n\r\n'\u5b9a\u7fa9\u3057\u305f\u9023\u60f3\u914d\u5217\u306bDirectory\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\r\nSet [\u9023\u60f3\u914d\u5217\u540d] = New Dictionary\r\n\r\n'\u9023\u60f3\u914d\u5217\u306b\u3001\u5024\u3092\u8ffd\u52a0\r\n[\u9023\u60f3\u914d\u5217\u540d].Add [Key], [Item]<\/pre>\n<h5>\uff11-\uff13-\uff11-\uff12\uff0e\u9023\u60f3\u914d\u5217\u3078\u306e\u8ffd\u52a0\u3068\u53d6\u5f97\u65b9\u6cd5<\/h5>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample01()\r\n    Dim test As Dictionary\r\n    Set test = New Scripting.Dictionary\r\n\r\n'\u9023\u60f3\u914d\u5217\u306b\u3001\u5024\u3092\u8ffd\u52a0\r\n    test.Add \"001\", \"1000\"\r\n    test.Add \"002\", \"2200\"\r\n    test.Add \"003\", \"3330\"\r\n\r\n'\u9023\u60f3\u914d\u5217\u304b\u3089\u30ad\u30fc\u5024\u304c\u300c001\u300d\u306e\u30a2\u30a4\u30c6\u30e0\u5024\u3092\u53d6\u5f97\uff081\u3064\u76ee\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\uff09\r\n    MsgBox \"001\" &amp; \"\uff1a\" &amp; test.Item(\"001\")\r\nEnd Sub<\/pre>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u7d50\u679c\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c1.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c1.png\" alt=\"\u5b9f\u884c\u7d50\u679c1\" width=\"160\" height=\"186\" class=\"alignnone size-full wp-image-4109\" \/><\/a><\/p>\n<h4>\uff11-\uff13-\uff12\uff0eRuntime\u3092\u4f7f\u308f\u306a\u3044\u5834\u5408<\/h4>\n<h5><span>\uff11-\uff13-\uff12-\uff11\uff0e<\/span>\u9023\u60f3\u914d\u5217\u306e\u5b9a\u7fa9\u65b9\u6cd5<\/h5>\n<pre class=\"prettyprint lang:default decode:true\">'\u9023\u60f3\u914d\u5217\u3092Object\u578b\u3067\u5b9a\u7fa9\r\nDim [\u9023\u60f3\u914d\u5217\u540d] as Object\r\n\r\n'\u5b9a\u7fa9\u3057\u305f\u9023\u60f3\u914d\u5217\u306bDirectory\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u53c2\u7167\u3092\u4f5c\u6210\r\nSet [\u9023\u60f3\u914d\u5217\u540d] = CreateObject(\"Scripting.Dictionary\")\r\n\r\n'\u9023\u60f3\u914d\u5217\u306b\u3001\u5024\u3092\u8ffd\u52a0\r\n[\u9023\u60f3\u914d\u5217\u540d].Add [Key], [Item]<\/pre>\n<h5>\uff11-\uff13-\uff12-\uff12\uff0e\u9023\u60f3\u914d\u5217\u3078\u306e\u8ffd\u52a0\u3068\u53d6\u5f97\u65b9\u6cd5<\/h5>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample02()\r\n    Dim test As Dictionary\r\n    Set test = New Scripting.Dictionary\r\n\r\n    test.Add \"001\", \"1000\"\r\n    test.Add \"002\", \"2200\"\r\n    test.Add \"003\", \"3330\"\r\n\r\n'\u9023\u60f3\u914d\u5217\u304b\u3089\u5024\u3092\u53d6\u5f97\uff081\u3064\u76ee\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\uff09\r\n    MsgBox test.Keys(0) &amp; \"\uff1a\" &amp; test.Items(0)\r\nEnd Sub<\/pre>\n<p><span class=\"f-marker-p\">\u5b9f\u884c\u7d50\u679c\uff1a<\/span><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c2.png\" alt=\"\u5b9f\u884c\u7d50\u679c2\" width=\"160\" height=\"186\" class=\"alignnone size-full wp-image-4110\" \/><\/a><\/p>\n<h2><span id=\"Dictionary\">\uff12\uff0e<span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u7279\u6b8a\u306a\u4f7f\u3044\u65b9<\/span><\/h2>\n<h3><span id=\"-Key\">\uff12-\uff11\uff0e\u91cd\u8907\u3059\u308b<span>Key<\/span>\u3092\u53d6\u308a\u8fbc\u307e\u306a\u3044<\/span><\/h3>\n<p><span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u91cd\u8907\u3057\u305f<span>Key<\/span>\u3092\u8ffd\u52a0\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span>Key<\/span>\u304c\u3059\u3067\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u305f\u65b9\u304c\u5b89\u5168\u3067\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample03()\r\n    Dim test As Object\r\n    Set test = CreateObject(\"Scripting.Dictionary\")\r\n\r\n    test.Add \"001\", \"1000\"\r\n    test.Add \"002\", \"2200\"\r\n    test.Add \"003\", \"3330\"\r\n\r\n'\u8ffd\u52a0\u3057\u305f\u3044\u5024\r\n    Dim addKey As String\r\n    Dim addItem As String\r\n    addKey = \"004\"\r\n    addItem = \"4444\"\r\n\r\n    For i = 0 To test.Count - 1\r\n        '\u8ffd\u52a0\u3059\u308bKey\u5024\u304c\u3001\u65e2\u306b\u9023\u60f3\u914d\u5217\u306b\u5b58\u5728\u3059\u308b\u304b\u30c1\u30a7\u30c3\u30af\r\n        If Not test.Exists(addKey) Then\r\n            '\u5b58\u5728\u3057\u306a\u3044\u306a\u3089\u8ffd\u52a0\r\n            test.Add addKey, addItem\r\n            Exit For\r\n        End If\r\n    Next i\r\n\r\nEnd Sub<\/pre>\n<h3><span id=\"i\">\uff12-\uff12\uff0e\u8a2d\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b<\/span><\/h3>\n<p>\u8a2d\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u884c\u3044\u307e\u3059<\/p>\n<h4><span>\uff12-\uff12-\uff11\uff0e<\/span>\u30c7\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u3066\u524a\u9664<\/h4>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample04()\r\n    Dim test As Dictionary\r\n    Set test = New Scripting.Dictionary\r\n\r\n    test.Add \"001\", \"1000\"\r\n    test.Add \"002\", \"2200\"\r\n    test.Add \"003\", \"3330\"\r\n\r\n    '\u524a\u9664\u524d\u306e\u914d\u5217\u3092\u8868\u793a\r\n    wk = \"\u524a\u9664\u524d\u306e\u914d\u5217\uff08\u4ef6\u6570\uff1a\" &amp; test.Count &amp; \"\uff09\" &amp; vbCrLf\r\n    For i = 0 To test.Count - 1\r\n        wk = wk &amp; test.Keys(i) &amp; \"\uff1a\" &amp; test.Items(i) &amp; vbCrLf\r\n    Next i\r\n    MsgBox wk\r\n\r\n    '\u300c002\u300d\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\r\n    test.Remove \"002\"\r\n    \r\n    '\u524a\u9664\u524d\u306e\u914d\u5217\u3092\u8868\u793a\r\n    wk = \"\u524a\u9664\u524d\u306e\u914d\u5217\uff08\u4ef6\u6570\uff1a\" &amp; test.Count &amp; \"\uff09\" &amp; vbCrLf\r\n    For i = 0 To test.Count - 1\r\n        wk = wk &amp; test.Keys(i) &amp; \"\uff1a\" &amp; test.Items(i) &amp; vbCrLf\r\n    Next i\r\n    MsgBox wk\r\n\r\nEnd Sub\r\n<\/pre>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u524d\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u524d.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u524d.png\" alt=\"\u5b9f\u884c\u524d\" width=\"218\" height=\"243\" class=\"alignnone size-full wp-image-4111\" \/><\/a><\/p>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u7d50\u679c\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c3.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c3.png\" alt=\"\u5b9f\u884c\u7d50\u679c3\" width=\"218\" height=\"224\" class=\"alignnone size-full wp-image-4112\" \/><\/a><\/p>\n<h4>\uff12-\uff12-\uff12\uff0e\u5168\u30c7\u30fc\u30bf\u3092\u524a\u9664<\/h4>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample05()\r\n    Dim test As Dictionary\r\n    Set test = New Scripting.Dictionary\r\n\r\n    test.Add \"001\", \"1000\"\r\n    test.Add \"002\", \"2200\"\r\n    test.Add \"003\", \"3330\"\r\n\r\n    '\u524a\u9664\u524d\u306e\u914d\u5217\u3092\u8868\u793a\r\n    wk = \"\u524a\u9664\u524d\u306e\u914d\u5217\uff08\u4ef6\u6570\uff1a\" &amp; test.Count &amp; \"\uff09\" &amp; vbCrLf\r\n    For i = 0 To test.Count - 1\r\n        wk = wk &amp; test.Keys(i) &amp; \"\uff1a\" &amp; test.Items(i) &amp; vbCrLf\r\n    Next i\r\n    MsgBox wk\r\n\r\n    '\u300c002\u300d\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\r\n    test.RemoveAll\r\n    \r\n    '\u524a\u9664\u5f8c\u306e\u914d\u5217\u3092\u8868\u793a\r\n    wk = \"\u524a\u9664\u5f8c\u306e\u914d\u5217\uff08\u4ef6\u6570\uff1a\" &amp; test.Count &amp; \"\uff09\" &amp; vbCrLf\r\n    For i = 0 To test.Count - 1\r\n        wk = wk &amp; test.Keys(i) &amp; \"\uff1a\" &amp; test.Items(i) &amp; vbCrLf\r\n    Next i\r\n    MsgBox wk\r\n\r\nEnd Sub\r\n<\/pre>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u524d\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u524d2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u524d2.png\" alt=\"\u5b9f\u884c\u524d2\" width=\"218\" height=\"243\" class=\"alignnone size-full wp-image-4113\" \/><\/a><\/p>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u7d50\u679c\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c4.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c4.png\" alt=\"\u5b9f\u884c\u7d50\u679c4\" width=\"218\" height=\"186\" class=\"alignnone size-full wp-image-4114\" \/><\/a><\/p>\n<h2><span id=\"Dictionary-2\">\uff13\uff0e<span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u305d\u306e\u4ed6\u306e\u4f7f\u7528\u4f8b<\/span><\/h2>\n<h3><span id=\"-Excel\">\uff13-\uff11\uff0e\u9023\u60f3\u914d\u5217\u306b\u8ffd\u52a0\u3059\u308b\u30c7\u30fc\u30bf\u3092\u3001<span>Excel<\/span>\u306e\u30bb\u30eb\u304b\u3089\u53d6\u5f97<\/span><\/h3>\n<p>\u8ffd\u52a0\u3059\u308b\u30c7\u30fc\u30bf\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a<span>Excel<\/span>\u8868\u304b\u3089\u53d6\u5f97\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 120px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\u30ad\u30fc<\/td>\n<td style=\"width: 50%; height: 24px;\">\u30a2\u30a4\u30c6\u30e0<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\u304a\u8336<\/td>\n<td style=\"width: 50%; height: 24px;\">120<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\u7d05\u8336<\/td>\n<td style=\"width: 50%; height: 24px;\">150<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\u30b3\u30fc\u30d2\u30fc<\/td>\n<td style=\"width: 50%; height: 24px;\">200<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">\u6c34<\/td>\n<td style=\"width: 50%; height: 24px;\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample06()\r\n    Dim test As Dictionary\r\n    Set test = New Scripting.Dictionary\r\n\r\n    With Worksheets(\"\u30c7\u30fc\u30bf\")       '\u300c\u30c7\u30fc\u30bf\u300d\u30b7\u30fc\u30c8\u5185\u3067\u306e\u4f5c\u696d\r\n        For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row\r\n            test.Add .Cells(i, 1).Value, .Cells(i, 2).Value\r\n        Next i\r\n    End With\r\n    \r\n    '\u914d\u5217\u3092\u8868\u793a\r\n    wk = \"\u914d\u5217\uff08\u4ef6\u6570\uff1a\" &amp; test.Count &amp; \"\uff09\" &amp; vbCrLf\r\n    For i = 0 To test.Count - 1\r\n        wk = wk &amp; test.Keys(i) &amp; \"\uff1a\" &amp; test.Items(i) &amp; vbCrLf\r\n    Next i\r\n    MsgBox wk\r\n\r\nEnd Sub\r\n<\/pre>\n<p><strong><span class=\"f-marker-p\">\u5b9f\u884c\u7d50\u679c\uff1a<\/span><\/strong><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c5.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2023\/08\/\u5b9f\u884c\u7d50\u679c5.png\" alt=\"\u5b9f\u884c\u7d50\u679c5\" width=\"164\" height=\"262\" class=\"alignnone size-full wp-image-4115\" \/><\/a><\/p>\n<h2><span id=\"i-2\">\uff14\uff0e\u6700\u5f8c\u306b<\/span><\/h2>\n<p><span>Dictionary<\/span>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u3001\u4e0a\u8a18\u4ee5\u5916\u306e\u4f7f\u3044\u65b9\u3082\u3042\u308a\u307e\u3059\u3002\u901a\u5e38\u306e\u914d\u5217\u3068\u4f7f\u3044\u5206\u3051\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VBA\u3067\u306f\u3001\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u6642\u306b\u914d\u5217\u3092\u3088\u304f\u4f7f\u7528\u3057\u307e\u3059\u3002 Dictionary\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u3088\u3046\u306b\u30ad\u30fc\u30ef\u30fc\u30c9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u76ee\u6b21\uff11\uff0eVBA\u306eDictionary \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3064\u3044\u3066\uff11 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":4106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/4104"}],"collection":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/comments?post=4104"}],"version-history":[{"count":7,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/4104\/revisions"}],"predecessor-version":[{"id":6232,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/4104\/revisions\/6232"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media\/4106"}],"wp:attachment":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media?parent=4104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/categories?post=4104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}