LoginSignup
0
0

More than 3 years have passed since last update.

VBAでセルの値をフォルダ名としてmkdirしたかっただけ

Posted at

メモ。
VBAリファレンス(DIr)


Sub createFolder()

    Dim targetDir As String: targetDir = "C:\test\"

    Dim i As Integer: For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
        Dim newDir As String: newDir = targetDir & Cells(i, 1).Value
        If Dir(newDir, vbDirectory) = vbNullString Then MkDir newDir
    Next i

    Debug.Print ("end")

End Sub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0