- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¦^´_ 1# koala2099
all-a.zip (25.81 KB)
- Private Sub cbLdData_Click()
- Dim iI%
- Dim sSh$(0 To 1)
- Dim lRow&, lRows&
- Dim vFs, vF
-
- sSh(0) = "s"
- sSh(1) = "e"
- For iI = 0 To 1
- With Sheets(sSh(iI))
- .Activate
- .Cells.ClearContents
- Set vFs = CreateObject("Scripting.FileSystemObject")
- Set vF = vFs.OpenTextFile(ThisWorkbook.Path & "\" & sSh(iI) & ".csv", 1, -2) ' ¨Ï¥Î¨t²Î¹w³]®æ¦¡¶}±Ò°ßŪ¤å¦rÀÉ®×
- lRow = 1
- Do While Not vF.AtEndOfStream
- With .Cells(lRow, 1)
- .Value = vF.readline
- .TextToColumns Comma:=True
- End With
- lRow = lRow + 1
- Loop
- vF.Close
- .Range(.[A2], .[B2]).Insert shift:=xlShiftDown
- lRow = 2
- lRows = 2
- Do While .Cells(lRows, 3) <> ""
- If .Cells(lRows, 1) <> "" Then
- .Rows(lRows).Cut
- .Cells(lRow, 1).Insert
- lRow = lRow + 1
- End If
- lRows = lRows + 1
- Loop
- On Error GoTo LdDataErr
- .[A1].SortSpecial key1:=.[A1], Header:=xlYes
- lRows = 2
- Do While .Cells(lRows, 1) <> ""
- lRows = lRows + 1
- Loop
- .Rows(lRows & ":" & Rows.Count).Delete
- End With
- Next iI
- On Error GoTo 0
- Exit Sub
-
- LdDataErr:
- Select Case Err.Number
- Case 1004
- Resume Next
- Case Else
- MsgBox "µo¥Í¿ù»~, ¿ù»~¥N½X : " & Err.Number & " ,¿ù»~ì¦] : " & Err.Description
- Exit Sub
- End Select
- End Sub
½Æ»s¥N½X |
|