根据单元格值创建文件夹



我在下面的代码中根据单元格值创建了多个文件夹,但我希望路径也应该从单元格中选择。

我在F4中有文件夹路径。所以我想在代码中添加F4,而不是文件夹路径。请帮助


Sub AFolderVBA2() 'Excel VBA to make a folder.
Dim i As Integer
For i = 2 To 4
MkDir "Desktop:ABC" & Range("AE" & i)
Next i
End Sub
Sub AFolderVBA2() 'Excel VBA to make a folder.
Dim i As Integer
Dim Path as string
Path = Range("F4").Value
For i = 2 To 4    
MkDir Path & Range("AE" & i)
Next i
End Sub

Sub Create_Folder()
Dim Rowno As Integer
Rowno = ActiveCell.Row
Dim ws As Worksheet
Dim Path As String
Dim Folder As String
Set ws = ActiveSheet
Path = ws.Range("AZ" & Rowno).Value
Folder = ws.Range("A" & Rowno).Value & " - " & "Docs" & " - " & ws.Range("M" & Rowno).Value
MkDir Path & Folder

End Sub

相关内容

  • 没有找到相关文章

最新更新