- ©«¤l
- 2834
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2890
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-27
|
¦^´_ 15# Jason80Lo
Sub TEST()
Dim xPath$, xF$, xS As Worksheet, xEnd As Range, xR As Range, TT, T, N$, C%
xPath = ThisWorkbook.Path & "\" '"C:\Users\j\Desktop\VBA TXT ¨Ì·Ó¬q¸¨¶}±Ò»Ý¨D\"
Set xS = ThisWorkbook.Sheets("¤u§@ªí1")
Do
¡@If xF = "" Then xF = Dir(xPath & "\*.txt") Else xF = Dir
¡@If xF = "" Then Exit Do
¡@If Not xS.[A:A].Find(xF, LookAT:=xlWhole) Is Nothing Then GoTo 101
¡@Set xEnd = xS.Cells(Rows.Count, 1).End(xlUp)(2)
¡@If xEnd.Row < 3 Then Set xEnd = xS.[A3]
¡@xEnd = xF
¡@
¡@N = ""¡@
¡@Open xPath & xF For Input Access Read As #1
¡@Do Until EOF(1)
¡@¡@¡@Line Input #1, T
¡@¡@¡@If T = "&" Then Set xR = xEnd(1, "B"): C = 0
¡@¡@¡@If T = "$" Then Set xR = xEnd(1, "BG"): C = 0
¡@¡@¡@If (T = "#" Or T = "%") And N = "" Then Set xR = xEnd(1, "FZ"): C = 0: N = "Y"
¡@¡@¡@If T = "@" Then Set xR = xEnd(1, "DX"): C = 0
¡@¡@¡@For Each TT In Split(T, " ")
¡@¡@¡@¡@¡@C = C + 1: xR(1, C) = TT
¡@¡@¡@Next
¡@Loop
¡@Close #1
101: Loop
End Sub |
|