¦U¦ì¤j¤j¦n¡G
¤p§Ì¹J¨ì¤@ÃøÃD¡A¤£ª¾¦p¦ó¸Ñ¶}¡C
¤p§Ì·Q¥Ñ¤å¦rÀɤº¨ú¥X«ü©w¸ê®Æ¡A
²{°ÝÃD¬O¤p§Ì§Q¥ÎINSTR¥i§ä¥X«ü©w¦r¦ênumber_special®É¡A
¦A§PÂ_¤U¤@¦Cªº¦r¦êct101_No®É¨ú¥X¼ÆȬ°¡G17¡A¤]´N¬O
n¨ú¥X¸Ó¦r¦êªº¤U¤@¦Cªº³¡¥÷¸ê®Æ¡C»yªk¤W¬°
K>0®É¥i§PÂ_¥X¤U¤@¦Cªº¦ì¸m¡C
¤p§Ì¤£·Q±N¤å¦rÀÉ¥ý¥þ³¡¸ü¦C©ó
¤u§@ªí¤º¡A¦A§Q¥ÎOFFSET¤è¦¡¥i逹¦¨¡C
¦Ó¬O§_¦³¨ä¥¦¤è¦¡¥iª½±µ¥Ñ¤å¦rÀɪº¤U¤@
¦C¨ú¥X¸ê®Æ©O¡H
¤å¦rÀɤºªº³¡¥÷¸ê®Æ¦p¤U¡G
<div align="center" class="number_special">
<span id="Lotto649Control_history1_dlQuery_ctl01_No">17</span> </div>
</td>
Sub TEST()
'³]©w¤Þ¥Î¶µ¥ØMicrosoft Scripting Runtime
Dim myFso As Scripting.FileSystemObject
Dim myTxt As Scripting.TextStream
Dim myStr As String
Dim mStr$, mStr1$, nStr1$, nStr2$, nStr3$, nStr4$, nStr5$, nStr6$
Dim m%, m1%, m2%, mLen%, n%, n1%, n2%, n3%, n4%, n5%, n6%, s1%, s2%, s3%, s4%, s5%, s6%, s7%, s8%
Dim mSht As Worksheet
Dim mRng As Range
Dim mTmp$, mTmp1$, numSpecial$
Dim myFs As FileSearch
Dim mPath As String, mFilename$
Dim i As Long, k%
numSpecial = "number_special"
mStr = "DrawTerm"
mStr1 = "DDate"
nStr1 = "_No1"
nStr2 = "_No2"
nStr3 = "_No3"
nStr4 = "_No4"
nStr5 = "_No5"
nStr6 = "_No6"
Set mSht = Worksheets("temp")
With mSht
.Cells.Clear
Set mRng = .Range("a1:i2000")
With mRng
.NumberFormatLocal = "@"
End With
Set myFs = Application.FileSearch
mPath = "D:\TEMP\"
With myFs
.NewSearch
.LookIn = mPath
.FileType = msoFileTypeAllFiles
.Filename = ".txt"
.SearchSubFolders = True
If .Execute(SortBy:=msoSortByFileName) > 0 Then
For i = 1 To .FoundFiles.Count
mFilename = .FoundFiles(i)
Set myFso = CreateObject("Scripting.FileSystemObject")
Set myTxt = myFso.OpenTextFile(Filename:=mFilename, IOMode:=ForReading)
s1 = mSht.[a65536].End(xlUp).Offset(1).Row
s2 = mSht.[b65536].End(xlUp).Offset(1).Row
s3 = mSht.[c65536].End(xlUp).Offset(1).Row
s4 = mSht.[d65536].End(xlUp).Offset(1).Row
s5 = mSht.[e65536].End(xlUp).Offset(1).Row
s6 = mSht.[f65536].End(xlUp).Offset(1).Row
s7 = mSht.[g65536].End(xlUp).Offset(1).Row
s8 = mSht.[h65536].End(xlUp).Offset(1).Row
With myTxt
Do Until .AtEndOfStream
myStr = Trim(.ReadLine)
If myStr <> "" Then
m = InStr(1, myStr, mStr, vbTextCompare)
m1 = InStr(1, myStr, mStr1, vbTextCompare)
n1 = InStr(1, myStr, nStr1, vbTextCompare)
n2 = InStr(1, myStr, nStr2, vbTextCompare)
n3 = InStr(1, myStr, nStr3, vbTextCompare)
n4 = InStr(1, myStr, nStr4, vbTextCompare)
n5 = InStr(1, myStr, nStr5, vbTextCompare)
n6 = InStr(1, myStr, nStr6, vbTextCompare)
k = InStr(1, myStr, numSpecial, vbTextCompare) '¦pªGk>0®Én¨ú¥X¤U¤@¦Cªº¼Æȸê®Æ
If m > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, m + 10, 9)
If IsNumeric(mTmp) Then
mSht.Cells(s1, 1).Value = mTmp
End If
s1 = s1 + 1
End If
If m1 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, m1 + 7, 8)
mTmp1 = Replace(mTmp, "/", "")
If IsNumeric(mTmp1) Then
mSht.Cells(s2, 2).Value = mTmp
End If
s2 = s2 + 1
End If
If n1 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n1 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s3, 3).Value = mTmp
End If
s3 = s3 + 1
End If
If n2 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n2 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s4, 4).Value = mTmp
End If
s4 = s4 + 1
End If
If n3 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n3 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s5, 5).Value = mTmp
End If
s5 = s5 + 1
End If
If n4 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n4 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s6, 6).Value = mTmp
End If
s6 = s6 + 1
End If
If n5 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n5 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s7, 7).Value = mTmp
End If
s7 = s7 + 1
End If
If n6 > 0 Then
mLen = Len(myStr)
mTmp = Mid(myStr, n6 + 6, 2)
If IsNumeric(mTmp) Then
mSht.Cells(s8, 8).Value = mTmp
End If
s8 = s8 + 1
End If
End If
Loop
.Close
End With
Set myTxt = Nothing 'ª«¥óªºÄÀ©ñ
Set myFso = Nothing
Next
End If
End With
End With
mSht.Range("a1:h1") = Array("´Á§O", "¤é´Á", "¤@", "¤G", "¤T", "¥|", "¤", "¤»")
mSht.Range("a1").Sort key1:=Range("a1"), order1:=xlAscending, header:=xlYes
For i = 2 To mSht.[a65536].End(xlUp).Row
mSht.Cells(i, 10) = mSht.Cells(i, 3) & mSht.Cells(i, 4) & mSht.Cells(i, 5) & mSht.Cells(i, 6) & mSht.Cells(i, 7) & mSht.Cells(i, 8) & mSht.Cells(i, 9)
Next
mSht.Range("j1") = "²Õ¦X¦r¦ê"
Set myFs = Nothing
Set mSht = Nothing
Set mRng = Nothing
End Sub
·PÁ¦U¦ì¤j¤j¡C |