我想遍历一列(项目),然后根据单元格的值创建一个具有特定单元格名称的文件夹 例如,如果找到x = 20,则创建文件夹“ 20_hhh”,我们有很多20个文件夹,但我只想要一个文件夹 如果找到30,则创建然后创建文件夹30 _hhh,依此类推!
每个时间x(单元格的值)增加10次
这是列的示例
Item
10
10
10
10
20
20
30
30
40
40
40
我有一个代码,但是它不起作用,有人可以帮助我吗?
Sub create_loop()
Dim BrowseForFolder As String
Dim fName5 As String
Dim fName3 As String
Dim fName1 As String
Dim fName4 As String
Dim x As String
With Worksheets("Output_" & Date).Range("B1:B100")
x = 20
fName5 = .Range("D3").Value
fName3 = "PO_"
fName1 = "000"
fName4 = "_"
BrowseForFolder = "X:\fei"
Set c = .Find(x, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MkDir "my specific folder"
x = 10 + x
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub