Option Explicit Const STRLEN As Long = 22 '定长,后面这个图好像也没发现有空格 Sub abc() Dim pth, i, a, f, d pth = Split("源文件,结果", ",") '源文件、目标文件目录 For i = 0 To UBound(pth) pth(i) = ThisWorkbook.Path & "\" & pth(i) & "\" If Dir(pth(i), vbDirectory) = vbNullString Then MsgBox pth(i): Exit Sub Next a = [a1].CurrentRegion.Offset(1).Resize(, 1).Value Set d = CreateObject("scripting.dictionary") For i = 1 To UBound(a) - 1 If Len(a(i, 1)) > STRLEN Then d(Left(a(i, 1), STRLEN)) = 1 Next f = Dir(pth(0) & "*.*") Do While Len(f) > STRLEN If d.exists(Left(f, STRLEN)) Then FileCopy pth(0) & f, pth(1) & f f = Dir Loop End Sub