- ©«¤l
- 192
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 194
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2016-9-22
- ³Ì«áµn¿ý
- 2020-8-28
|
¦^´_ 2# Hsieh
¦^ª©¤j
§Ú¬O¥Î³oºØ¤èªk¥i¬O¦³«]¦bÁÙn³Ð¸ê®Æ§¨
ÁÙ¬O±zªº¦n¥Î«¢«¢- Sub test()
- Range("B2").Select
- ActiveWindow.FreezePanes = True
-
- Dim p, f, arr1, arr2, arr3, arr4, dic
- Application.ScreenUpdating = False
- Set dic = CreateObject("scripting.dictionary")
- ActiveSheet.Range("B2:AO65535").ClearContents
- For j = 2 To ActiveSheet.Range("A1").CurrentRegion.Rows.Count
- dic(Cells(j, 1).Value) = j
- Next
- p = ThisWorkbook.Path & "\rawdata\"
- f = Dir(p & "*.xls")
- Do While Len(f)
- If f <> "" Then
- With GetObject(p & f)
- arr1 = .Sheets(2).Range("A2:A8")
- arr2 = .Sheets(2).Range("B2:U8")
- arr3 = .Sheets(2).Range("A13:A19")
- arr4 = .Sheets(2).Range("B13:U19")
- .Close SaveChanges:=False
- End With
- End If
- With ThisWorkbook.ActiveSheet
- For i = 1 To 7
- If dic(arr1(i, 1)) <> "" Then
- .Range("B" & dic(arr1(i, 1))).Resize(1, UBound(arr2, 2)).Value = WorksheetFunction.Index(arr2, i, 0)
- 'h1 = dic(arr2(i, 1))
-
- End If
- If dic(arr3(i, 1)) <> "" Then
- .Range("v" & dic(arr3(i, 1))).Resize(1, UBound(arr4, 2)).Value = WorksheetFunction.Index(arr4, i, 0)
- End If
- Next
- End With
- f = Dir
- Loop
- Application.ScreenUpdating = True
- End Sub
½Æ»s¥N½X |
|