|
- Private Sub CommandButton1_Click()
- Dim fil(), brr()
- Application.ScreenUpdating = False
- With Application.FileDialog(msoFileDialogFilePicker)
- .AllowMultiSelect = True
- .Filters.Clear
- .Filters.Add "excel", "*.xl*", 1
- .InitialFileName = ThisWorkbook.Path
- If .Show = -1 Then
- ReDim fil(1 To .SelectedItems.Count)
- For i = 1 To UBound(fil)
- fil(i) = .SelectedItems(i)
- Next
- End If
- End With
- ReDim brr(1 To UBound(fil), 1 To 10)
- pat = [{"^PGA", "^PMC", "^FLA", "^PLA", "^ALF", "^AKE", "^BLKS"}]
- Set reg = CreateObject("vbscript.regexp")
- For i = 1 To UBound(fil)
- With Workbooks.Open(fil(i))
- brr(i, 1) = Mid(.Name, 1, InStr(.Name, ".") - 1)
- arr = .Sheets(1).[a1].CurrentRegion
- .Close savechanges:=False
- End With
- brr(i, 2) = arr(2, 3): brr(i, 10) = arr(3, 3)
- For j = 6 To UBound(arr)
- For k = 1 To UBound(pat)
- reg.Pattern = pat(k)
- If reg.test(arr(j, 2)) Then brr(i, k + 2) = brr(i, k + 2) + 1: Exit For
- Next k
- Next j
- Next i
- Cells(Cells.Rows.Count, 1).End(3).Offset(1, 0).Resize(UBound(brr), 10) = brr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|