別ファイルCSVデータ取込

Sub Au取込()

高速開始

    Dim buf As String, A As Variant, i As Long, j As Long, fpath As String, dfile As String, Opath As String, today As String

    

   Worksheets("Au").Activate

   

   fpath = "\\00 全般\個人フォルダ\◎◎\13_金属相場\1_相場更新\金属相場csvダウンロードファイル\Au・Ag\Au_山元建値(c173_4)"

'   today = Format(Date, "yyyymmdd")

   today = Worksheets("実行").Range("D1").Value

dfile = Dir(fpath & "\*.csv?")

   Opath = fpath & "\" & dfile

    Open Opath For Input As #1

        Do Until EOF(1)

            i = i + 1

            Line Input #1, buf

            A = Split(buf, ",")

            For j = 0 To UBound(A)

                Cells(i, j + 1) = A(j)

            Next j

        Loop

    Close #1

高速終了

End Sub