|
本帖最后由 lsc900707 于 2018-7-31 22:01 编辑
Sub gj23w98()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel Files", "*.xls;*.xlsx"
.Filters.Add "All Files", "*.*"
If .Show = -1 Then
MsgBox "????????????" & .SelectedItems(1), vbOKOnly + vbInformation, "???????"
End If
End With
Set wb = GetObject(Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1))
Set d = CreateObject("scripting.dictionary")
With wb
For Each sht In .Sheets
If sht.Name <> "????" Then
With sht
arr = .UsedRange
For i = 4 To UBound(arr)
s = arr(i, 1) & .Name
d(s) = arr(i, 2)
Next
End With
End If
Next
End With
brr = [a1].CurrentRegion
For i = 7 To UBound(brr)
For j = 2 To UBound(brr, 2)
s = brr(i, 1) & Day(brr(1, j))
If d.exists(s) Then brr(i, j) = d(s)
Next
Next
[a1].CurrentRegion = brr
Set wb = Nothing
Set d = Nothing
End Sub
|
|