- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 32# dreamsway
¸Õ¸Õ¬Ý- Option Explicit
- Const ¶¡¹j = #12:05:00 AM# '³o¸Ìקï¤ÀÄÁ¶¡¹j
- Const ¶}½L = #8:45:00 AM#
- Public Sht2 As Worksheet
- Sub K¤ßºA()
- Dim i As Long, Ti As Integer, ¦¨¥æ»ù As Double, ¦hÁ` As Long, ªÅÁ` As Long, ¤è¦V As String
- Dim xTime As Date, wTime As Date, Q As Variant
- '*************************************
- Set Sht2 = Sheets("³ø»ù¼Æ¾Ú")
- With Sht2
- For Each Q In .QueryTables
- Q.Delete
- Next
- For Each Q In .Names
- Q.Delete
- Next
- End With
- ¶×¤JAPI³ø»ù¤å¦rÀÉ
- '**************************************
- xTime = ¶}½L + ¶¡¹j
- i = 1: Ti = 0: ¦hÁ` = 0: ªÅÁ` = 0
- ¦¨¥æ»ù = Sheets("¦hªÅÂŹÏ").Range("M4") 'Äæ¦ì¼È¥N
- Do
- With Sht2.Range("b1").Offset(i)
- '**¶¡¹j¬° #12:05:00 AM# ³o"¡ô","¡õ"¼Æ¾Ú ·Ç½T¶Ü?***
- If ¦¨¥æ»ù < .Cells(1, 2) Then ¤è¦V = "¡ô"
- If ¦¨¥æ»ù > .Cells(1, 2) Then ¤è¦V = "¡õ"
-
- If ¦¨¥æ»ù <= .Cells(1, 2) And ¤è¦V = "¡ô" Then ¦hÁ` = ¦hÁ` + .Cells(2, 3)
- If ¦¨¥æ»ù >= .Cells(1, 2) And ¤è¦V = "¡õ" Then ªÅÁ` = ªÅÁ` + .Cells(2, 3)
- ¦¨¥æ»ù = .Cells(1, 2)
- If .Value > xTime + ¶¡¹j Then
- With Sheets("´ú¸Õ").Range("A2").Offset(Ti)
- .Resize(, 3) = Array(xTime, ¦hÁ`, ªÅÁ`)
- .NumberFormatLocal = "hh:mm;@"
- End With
- xTime = xTime + ¶¡¹j: Ti = Ti + 1
- Else
- If .Cells.Offset(1) = "" And Format(TimeValue(.Cells.Text), "HH:MM") = "13:45" Then
- '***µ{¦¡¹B¦æ³t«×«Ü§Ö·|¶]§¹³ø»ù¼Æ¾Ú,®É¶¡¤w¨ì"13:45"¦¬½L ¤£¦A¦³¼Æ¾Ú¤F **
- xTime = xTime + ¶¡¹j
- With Sheets("´ú¸Õ").Range("A2").Offset(Ti)
- .Resize(, 3) = Array(xTime, ¦hÁ`, ªÅÁ`)
- .NumberFormatLocal = "hh:mm;@"
- End With
- Exit Do
- ElseIf .Cells.Offset(1) = "" Then
- '****µ{¦¡¹B¦æ³t«×«Ü§Ö·|¶]§¹³ø»ù¼Æ¾Ú,¦ý¬O¼Æ¾ÚÁÙ·|¦³ ¦]®É¶¡ÁÙ¥¼¨ì"13:45"¦¬½L ®É ... **
- '**µ{¦¡¨ì³o²z °õ¦æ «·s¾ã²z ªºµ{¦¡ ¦³§ó·s¨ì _20180724_Match ¹ï¶Ü? **
- '**********************************************
- wTime = Time
- Do
- If wTime < Time - #12:00:30 AM# Then '30¬í «·s¾ã²z ¤@¦¸
- '**¸Õµy«Ý¤@¤Uµ¥Ô·sªº¼Æ¾Ú
- Application.StatusBar = "«·s¾ã²z...."
- ¶×¤JAPI³ø»ù¤å¦rÀÉ '** §ó·s _20180724_Match ¦p¦³·sªº¸ê®Æ¶i¨Ó
- '*************************.Cells.Offset(1)´N <>"" ***
- wTime = Time
- End If
- DoEvents
- Loop While .Cells.Offset(1) = "" '**ÁÙ¬O¨S¦³·sªº¼Æ¾Ú´N¤@ª½µ¥Ô...
- '*** ¦p¦³·sªº¸ê®Æ¶i¨Ó Â÷¶}°j°é Ä~Äò¤U¥h¨ì i = i + 1 ªº¦a¤è ¦A Loop ¤U¥h ***
- Application.StatusBar = False
- End If
- End If
- End With
- DoEvents
- i = i + 1
- Loop
- MsgBox "¤u§@§¹¦¨"
- End Sub
- Sub ¶×¤JAPI³ø»ù¤å¦rÀÉ() 'ÁÙ¨S½Õ¾ã¸ô®|¦r¦ê¡A¸ô®|2²Õ¤é´Á§ï¬°·í¤é¤é´Á¡ATXFH8«h¬°sht1¦hªÅÂŹϪºA4Àx¦s®æ
- With Sht2
- If .QueryTables.Count = 0 Then
- With .QueryTables.Add(Connection:= _
- "TEXT;C:\API\20180724\TXFH8\20180724_Match.txt", Destination:=.Range("$A$2"))
- .Name = "20180724_Match"
- '.FieldNames = True '¹w³]Ȭ° True ¥i¤£¥Î¦C¥X
- .RowNumbers = False
- .FillAdjacentFormulas = False
- '.PreserveFormatting = True '¹w³]Ȭ° True¡C¥i¤£¥Î¦C¥X
- '.RefreshOnFileOpen = False '¹w³]Ȭ° False¡C¥i¤£¥Î¦C¥X
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- '.AdjustColumnWidth = True '¹w³]Ȭ° True¡C¥i¤£¥Î¦C¥X
- .RefreshPeriod = 0
- '.TextFilePromptOnRefresh = False '¹w³]Ȭ° False¡C¥i¤£¥Î¦C¥X
- .TextFilePlatform = 950
- .TextFileStartRow = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- '.TextFileConsecutiveDelimiter = False '¹w³]Ȭ° False ¡C¥i¤£¥Î¦C¥X
- .TextFileTabDelimiter = True
- '.TextFileSemicolonDelimiter = False '¹w³]Ȭ° False ¡C¥i¤£¥Î¦C¥X
- .TextFileCommaDelimiter = True
- '.TextFileSpaceDelimiter = False '¹w³]Ȭ° False ¡C¥i¤£¥Î¦C¥X
- .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- End With
- Else
- .QueryTables(1).Refresh
- End If
- .Columns("B:B").NumberFormatLocal = "h:mm:ss;@"
- End With
- End Sub
½Æ»s¥N½X |
|