|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
'这段语句的作用是在当前文件夹模糊找到文件名匹配的,把找到匹配的文件薄的内容复制到当前文件薄
Sub test()
Dim Wb As Workbook
Dim Temp As String
Application.ScreenUpdating = False
Name = Dir(ThisWorkbook.Path & "\*.xls")
While Name <> ""
If Name Like "*" & "情况" & "*" Then
Temp = ThisWorkbook.Path & Name
Set Wb = GetObject(Temp)
Wb.Sheets("报送报阅").Range("A1:f100").CurrentRegion.Copy Sheets("报送报阅").Range("A1:f100")
Wb.Close False
Set Wb = Nothing
End If
Wend
Application.ScreenUpdating = True
End Sub
|
|