| ©«¤l11 ¥DÃD1 ºëµØ0 ¿n¤À17 ÂI¦W0  §@·~¨t²ÎWindowsXP ³nÅ骩¥»2003 ¾\ŪÅv10 ©Ê§O¤k µù¥U®É¶¡2011-9-29 ³Ì«áµn¿ý2013-5-22 
  
 | 
                
| ½Ð°ÝGBKEEª©¤j¡A¦pªG§Ú¤u§@ªí³£¦³¯S®íªº©R¦W¤è¦¡¡]¤é´Á+§ë¤J¶q¡^¡A¥i§_¥H°}¦C¤è¦¡±N¤§«e·s¼WªºÀÉ®×§R°£¡A¤U±¬O§Úªºµ{¦¡½X¡G PS.§Úª¾¹D¤£¯à¥Îdir¨Ó«ü©w¤u§@¶¡A¤£¹L¥Ø«e§ÚÁÙ¨S·Q¨ì¨ä¥L¤è¦¡
 ½Æ»s¥N½XSub §ë¤J¶q()
    Set MyBook = ThisWorkbook
    Set MySht = MyBook.Sheets("³øªí")
    MyPath = MyBook.Path & "\§ë¤J¶q\"
 
    '§R°£¤u§@¶
    Dim FindSht( ) As String
    FindSht( ) = Dir(MyBook.Sheet("*§ë¤J¶q"))
    Do While FindSht( ) <> ""
        FindSht( ).Delete
    Loop
 
    '¶×¤J¸ê®Æ
    Dim str(1), FindFile(1) As String, WbDate(1) As Date
    For i = 3 To 95
        If i Mod 3 = 0 Then
            If MySht.Cells(i, 1).Value <> "" Then
                WbDate(0) = MySht.Cells(i, 1).Value
                WbDate(1) = MySht.Cells(i, 1).Value + 1
                str(0) = Format(WbDate(0), "mmddyyyy")
                str(1) = Format(WbDate(1), "mmddyyyy")
                FindFile(0) = Dir(MyPath & "d_ic1_" & str(0) & "_0200.xls")                 '¶}date(0)ÀÉ®×
                If FindFile(0) <> "" Then
                    Workbooks.Open MyPath & FindFile(0)
                    Windows("d_ic1_" & str(0) & "_0200.xls").Activate
                    Range("C35:F35").Select
                    Application.CutCopyMode = False
                    Selection.Copy
                
                    Windows("¦yÂ÷®pµo¹q¤ÎµI¤Æ¶q²Îp.xls").Activate
                    Worksheets.Add
                    ActiveSheet.Name = Mid(str(0), 1, 4) + "§ë¤J¶q"
                    Range("B2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                    :=False, Transpose:=False
                    Workbooks(FindFile(0)).Close SaveChanges:=False
                Else
                    MsgBox "§ä¤£¨ìÀÉ®×: " & "d_ic1_" & str(0) & "_0200.xls", 0 + 48, ">>´£¥Ü°T®§": Exit Sub 'Exit For·|²£¥ÍnextµLfor¿ù»~!!
                    Application.ScreenUpdating = False
                End If
        
                FindFile(1) = Dir(MyPath & "d_ic1_" & str(1) & "_0200.xls")                 '¶}date(1)ÀÉ®×
                If FindFile(1) <> "" Then
                    Workbooks.Open MyPath & FindFile(1)
                    Windows("d_ic1_" & str(1) & "_0200.xls").Activate
                    Range("C12:F34").Select
                    Application.CutCopyMode = False
                    Selection.Copy
                    Windows("¦yÂ÷®pµo¹q¤ÎµI¤Æ¶q²Îp.xls").Activate
                    Sheets(Mid(str(0), 1, 4) + "§ë¤J¶q").Activate
                    Range("B3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                    :=False, Transpose:=False
                    Range("A1").FormulaR1C1 = "Hour"
                    Range("A2").FormulaR1C1 = "00:00"
                    Range("A3").FormulaR1C1 = "01:00"
                    Range("A2:A3").Select
                    Selection.AutoFill Destination:=Range("A2:A25")
    
                    Range("B1").FormulaR1C1 = "#1Äl§ë¤J¶q"
                    Range("C1").FormulaR1C1 = "#2Äl§ë¤J¶q"
                    Range("D1").FormulaR1C1 = "#3Äl§ë¤J¶q"
                    Range("E1").FormulaR1C1 = "#4Äl§ë¤J¶q"
                    
                    Range("G1").FormulaR1C1 = "ȧO"
                    Range("G2").FormulaR1C1 = "1"
                    Range("G3").FormulaR1C1 = "2"
                    Range("G4").FormulaR1C1 = "3"
                    Range("H1").FormulaR1C1 = "#1Äl§ë¤J¶q"
                    Range("H2").FormulaR1C1 = "=SUM(RC[-6]:R[8]C[-6])"
                    Range("H3").FormulaR1C1 = "=SUM(R[8]C[-6]:R[14]C[-6])"
                    Range("H4").FormulaR1C1 = "=SUM(R[14]C[-6]:R[21]C[-6])"
                    Range("I1").FormulaR1C1 = "#2Äl§ë¤J¶q"
                    Range("I2").FormulaR1C1 = "=SUM(RC[-6]:R[8]C[-6])"
                    Range("I3").FormulaR1C1 = "=SUM(R[8]C[-6]:R[14]C[-6])"
                    Range("I4").FormulaR1C1 = "=SUM(R[14]C[-6]:R[21]C[-6])"
                    Range("J1").FormulaR1C1 = "#3Äl§ë¤J¶q"
                    Range("J2").FormulaR1C1 = "=SUM(RC[-6]:R[8]C[-6])"
                    Range("J3").FormulaR1C1 = "=SUM(R[8]C[-6]:R[14]C[-6])"
                    Range("J4").FormulaR1C1 = "=SUM(R[14]C[-6]:R[21]C[-6])"
                    Range("K1").FormulaR1C1 = "#4Äl§ë¤J¶q"
                    Range("K2").FormulaR1C1 = "=SUM(RC[-6]:R[8]C[-6])"
                    Range("K3").FormulaR1C1 = "=SUM(R[8]C[-6]:R[14]C[-6])"
                    Range("K4").FormulaR1C1 = "=SUM(R[14]C[-6]:R[21]C[-6])"
                    Range("L1").FormulaR1C1 = "ªþµù"
                    Range("L2").FormulaR1C1 = "23:00~08:00"
                    Range("L3").FormulaR1C1 = "08:00~15:00"
                    Range("L4").FormulaR1C1 = "15:00~23:00"
                    
                    Workbooks(FindFile(1)).Close SaveChanges:=False
                Else
                    MsgBox "§ä¤£¨ìÀÉ®×: " & "d_ic1_" & str(1) & "_0200.xls", 0 + 48, ">>´£¥Ü°T®§": Exit Sub
                    Application.ScreenUpdating = False
                End If
            End If
        End If
    Next
End Sub
 | 
 |