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