Excel VBAでハッシュを使う方法のまとめです。 1.はじめに Excel VBAではハッシュテーブル(連想配列)を使うことができます。 で、ネットで検索してもパッとみて分かるようなサンプルがなかったので、できるだけ無駄なものを省いたサンプルを使って本エントリーで説明してみたいと思います。 2.サンプル まずはざっくりしたサンプルから紹介します。 Sub test() Dim obj As Object Set obj = CreateObject("Scripting.Dictionary") obj.Add "foo", 100 obj.Add "bar", 200 obj.Add "hoge", 300 Dim key As Variant For Each key In obj MsgBox obj(key) Next key Set obj = Nothing End Sub
![Excel VBAでハッシュを使う方法のまとめ](https://cdn-ak-scissors.b.st-hatena.com/image/square/49145d092d3d231cd8d95fd8008abf0895f02530/height=288;version=1;width=512/https%3A%2F%2Fwww.koikikukan.com%2Fimages%2F2014%2Fexcel_logo.jpg)