CSVファイルを読み込んでセルに2次元展開して配置する
vbっていつも変態ループになってしまうんだが、これでちゃんと回るんだからがしょうがない。
Function read_etc(category As String) Dim FileNamePath,CURRENT_PATH,ETC_PATH,FILE_NAME As String Dim textline, csvline() As String Dim Rowcnt, ColumNum As Integer Dim ch1 As Long FileNamePath = CURRENT_PATH & ETC_PATH & FILE_NAME ch1 = FreeFile Open FileNamePath For Input As #ch1 On Error GoTo CloseFile Rowcnt = SHEET_OFFSET Do While Not EOF(ch1) Line Input #ch1, textline csvline() = Split(textline, Chr(9)) ' 列数は動的判断するべきですがしてないです。 Range(Cells(Rowcnt, 1), _ Cells(Rowcnt, UBound(csvline()) + 1)) = csvline() Rowcnt = Rowcnt + 1 Loop CloseFile: Close #ch1 End Function