我有一个基于Q列中的数据创建新文件夹的宏。除了需要使用数据填充R列以使其工作之外,它的效果很好。
我不明白这一点,因为R列中的数据无关紧要。它没有出错,文件夹由于某种原因不显示。
Sub CreateFolders()
Dim FolderListRange As Range
Dim FolderRange As Variant
Dim FolderName As String
Dim ParentFolderPath As String
Set xWb = Application.ThisWorkbook
On Error GoTo Handle
ParentFolderPath = xWb.Path
Set FolderListRange = ActiveSheet.Range("Q2:Q64000").SpecialCells(xlCellTypeConstants)
For Each FolderRange In FolderListRange
If FolderRange.Offset(0, 1).Value = "" Then GoTo Continue
FolderName = ParentFolderPath & "\" & FolderRange.Value
If FileSystem.Dir(FolderName, vbDirectory) = vbNullString Then
FileSystem.MkDir FolderName
End If
Continue:
Next
Handle:
End Sub