|
Sub 按钮1_Click()
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = ThisWorkbook.Path & "\"
.Title = "请选择对应excel文件"
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel文件", "*.xls*"
If .Show Then f = .SelectedItems(1) Else Exit Sub '
End With
Application.ScreenUpdating = False
With Workbooks.Open(f)
arr = .Sheets(1).UsedRange
.Close False
End With
r = 0
For j = 2 To UBound(arr)
If InStr(arr(j, 5), "总数") > 0 Then Exit For
If Len(arr(j, 2)) > 0 Then
If Left(arr(j, 2), 1) Like "[A-Z]" Then
r = r + 1
arr(r, 1) = arr(j, 2)
arr(r, 2) = Val(arr(j, 6))
End If
End If
Next j
Sheets(1).UsedRange.Offset(1).ClearContents
[a2].Resize(r, 2) = arr
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|