| ©«¤l4901 ¥DÃD44 ºëµØ24 ¿n¤À4916 ÂI¦W266  §@·~¨t²ÎWindows 7 ³nÅ骩¥»Office 20xx ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥x¥_ µù¥U®É¶¡2010-4-30 ³Ì«áµn¿ý2025-10-30 
                
 | 
                
| ¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-5-19 14:49 ½s¿è 
 ¦^´_ 41# PJChen
 ½Æ»s¥N½XSub get_value()
Dim Sh As Worksheet, a As Range, Ar(), B As Range, B1 As Range
Set d = CreateObject("Scripting.Dictionary")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
fd = ThisWorkbook.Path & "\" & "PI_PO\"
fs = Dir(fd & "*xls*")
Do Until fs = ""
With Workbooks.Open(Filename:=fd & fs, UpdateLinks:=False)
n = Split(fs, " ")(0)
s = InStr(n, "BCM") + 3
fn = Mid(n, s)
   For Each Sh In .Sheets
      With Sh
      If Trim(.Name) <> "PO" And Trim(.Name) <> "PI" Then GoTo 10
      ay = .UsedRange.Value
      For i = 1 To UBound(ay)
         mystr = ""
         For j1 = 1 To UBound(ay, 2)
            mystr = IIf(mystr = "", UCase(Trim(.Cells(i, j1).Text)), mystr & Chr(10) & UCase(Trim(.Cells(i, j1).Text)))
         Next
         If Trim(Replace(mystr, Chr(10), "")) Like "TOTAL*PCS?*" Then
         ak = Split(mystr, "PCS")
         ax = Split(Trim(ak(0)), Chr(10))
         ap = Split(Trim(ak(1)), Chr(10))
               d(Trim(.Name) & "¼Æ¶q") = ax(UBound(ax) - 1)
               d(Trim(.Name) & "ª÷ÃB") = ap(2)
               Exit For
         End If
      Next
      End With
10
    Next
    ReDim Preserve Ar(y)
    Ar(y) = Array(fn, d("PI¼Æ¶q"), d("PIª÷ÃB"), d("PO¼Æ¶q"), d("POª÷ÃB"), fs)
    y = y + 1
    .Close
    d.RemoveAll
End With
fs = Dir
Loop
Sheets("Records").[A2].Resize(y, 6) = Application.Transpose(Application.Transpose(Ar))
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
 | 
 |