|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 移动文件夹()
Application.ScreenUpdating = False
Set fso = CreateObject("Scripting.FileSystemObject")
With ActiveSheet
r = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a1:a" & r)
End With
lj = ThisWorkbook.Path & "\原来文件夹\"
For i = 2 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
wjj = lj & ar(i, 1)
If fso.folderexists(wjj) Then
fso.movefolder wjj, ThisWorkbook.Path & "\结果\"
End If
End If
Next i
Set fso = Nothing
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|