|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
仅测试参考,也是帮你顶一下。- Sub test()
- Dim ar, p$, sp$, np$, fld, sfd, f, r%, fso As Object
- Set fso = CreateObject("scripting.filesystemobject")
- p = ThisWorkbook.Path & ""
- ar = Sheet1.[a1].CurrentRegion.Resize(, 4)
- On Error Resume Next
- For r = 2 To UBound(ar)
- np = p & ar(r, 2)
- If Dir(np, vbDirectory) = "" Then fso.createfolder np
- np = np & ""
- sp = p & "技术文件" & ar(r, 1) & ""
- For Each fld In fso.getfolder(sp).subfolders
- If fld.Name = ar(r, 3) Then
- fso.movefolder sp & fld.Name, np & fld.Name
- End If
- Next
- Next
- Err.Clear
- For Each fld In fso.getfolder(p).subfolders
- If fld.Name <> "技术文件" Then
- For Each sfd In fld.subfolders
- For Each f In sfd.Files
- If InStr(f.Name, "标签") = 0 Then Kill f
- Next
- Next
- End If
- Next
- Set fso = Nothing
- End Sub
复制代码 |
-
-
总表.rar
96.89 KB, 下载次数: 25
仅供参考
评分
-
1
查看全部评分
-
|