|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub test()
Dim i&, Items As FileDialogSelectedItems, strPath$, wkb As Workbook, wks As Worksheet
strPath = ThisWorkbook.Path & "\"
With Application.FileDialog(1)
With .Filters
.Clear
.Add "Excel Files", "*.xls"
End With
.AllowMultiSelect = False
.InitialFileName = strPath
If .Show Then Set Items = .SelectedItems Else Exit Sub
End With
Application.ScreenUpdating = False
Set wkb = GetObject(Items(1))
For Each wks In Worksheets
For i = 1 To wkb.Worksheets.Count
With wkb.Worksheets(i)
If .Name = wks.Name Then
wks.[A1].CurrentRegion.Offset(1).Clear
.[A1].CurrentRegion.Copy wks.[A2]
Exit For
End If
End With
Next i
Next
wkb.Close False
Set wkb = Nothing
Set Items = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|