回答編集履歴

1

コード間違い修正

2022/08/27 07:11

投稿

hatena19
hatena19

スコア33795

test CHANGED
@@ -12,6 +12,7 @@
12
12
  Dim dic '// 連想配列(Dictionary)
13
13
  Dim sLine '// CSVファイルの行文字列
14
14
  Dim v '// カンマ分割後の配列
15
+ Dim iColumn
15
16
 
16
17
  Set oFS = CreateObject("Scripting.FileSystemObject")
17
18
  Set oTS = oFS.OpenTextFile(a_sFilePath)
@@ -26,16 +27,16 @@
26
27
  ' カンマ区切り配列をループ
27
28
  For iColumn = 0 To UBound(v)
28
29
  'Dictionaryにカンマ区切りの内容とその個数を格納
29
- If dic.Exists(w) Then
30
+ If dic.Exists(v) Then
30
- dic(w) = dic(w) + 1 '件数をカウントアップ
31
+ dic(v) = dic(v) + 1 '件数をカウントアップ
31
32
  Else
32
- dic.Add w, 1
33
+ dic.Add v, 1
33
34
  End If
34
35
  Next
35
36
  Loop
36
37
  Call oTS.Close
37
38
  'Functionの戻り値としてDictionaryを返す
38
- Set CsvToArray = dic
39
+ Set CsvToDic = dic
39
40
  End Function
40
41
 
41
42