- ©«¤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
|
¦^´_ 1# sandra_wang
¸Õ¸Õ¬Ý- Sub ¶×¤J¤å¦rÀÉ_Ex()
- Dim MyPath As String, TheDate As String, TheFile As String, ShName As String, Mystr As String, Rng As Range, E As Variant
- MyPath = ThisWorkbook.Path & "\" '¤å¦rÀÉ©Ò¦bªº¥Ø¿ý
- TheDate = Format(Date - 1, "mm/dd") '¨úªº¤é´Á
- On Error Resume Next 'DIR §ä¤£¨ìÀÉ®×·|²£¥Í¿ù»~
- TheFile = Dir(MyPath & "*MB-*" & TheDate & "*.log") '´M§äÀÉ®×
- If Err.Number > 0 Then MsgBox "§ä¤£¨ì " & TheDate & " ÀÉ®×": Exit Sub
- Do While TheFile <> ""
- On Error GoTo ShAdd '¤u§@ªí¤¤¨S¦³ ShName·|²£¥Í¿ù»~
- ShName = Mid(TheFile, InStr(TheFile, "MB-"), InStr(TheFile, "_") - InStr(TheFile, "MB-"))
- Set Rng = Sheets(ShName).Cells(Rows.Count, "A").End(xlUp)
- If Rng <> "" Then Set Rng = Rng.Offset(1)
- Open MyPath & TheFile For Input As #1 '¶}±Ò¤å¦rÀÉ
- Do While Not EOF(1) '¤£¬OÀɮש³³¡®É °õ¦æ°j°é
- Input #1, Mystr '±q¤w¶}±Òªº´`§ÇŪ¨ú¸ê®Æ¡A¨Ã±N¸ê®Æ«ü©wµ¹ÅܼơC->mystr
- For Each E In Split(Mystr, Chr(10))
- Rng = E
- Set Rng = Rng.Offset(1)
- Next
- Loop
- Close #1 'Ãö³¬¤å¦rÀÉ
- TheFile = Dir
- Loop
- Exit Sub
- ShAdd:
- ThisWorkbook.Sheets.Add.Name = ShName
- Err.Clear
- Resume
- End Sub
½Æ»s¥N½X |
|