- ©«¤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# oak0723-1
¸Õ¸Õ¬Ý- Option Explicit
- Dim Wb As Workbook
- Sub Ex()
- Dim xFile As String, Sh As Worksheet, i As Integer, Rng As Range
- Set Wb = Workbooks("03.XLS") '«ü©wªºXLS¾×
- xFile = ThisFile
- If InStr(xFile, "CSV") = False Then MsgBox xFile: Exit Sub
- Set Sh = Wb.Sheets("SHEET1") '«ü©wªºXLS¾×ªº¤u§@¶
- With Workbooks.Open(xFile)
- For i = 1 To 2
- Set Rng = .Sheets(1).Range(Sh.Cells(1 + 1, "E") & ":" & Sh.Cells(1 + i, "F")) '«ü©wªº¦ì¸m
- Set Rng = .Sheets(1).Range(Rng, Rng.End(xlDown)) ''«ü©wªº¦ì¸m©¹¤U¦Ü¸ê®Æªº²×ÂI
- With Sh.Cells(Rows.Count, "a").End(xlUp).Offset(1) 'AÄæ³Ì©³¦C©¹¤W¨ì¦³¸ê®ÆªºÀx¦s»Õªº¤U¤@¦C
- .Resize(Rng.Rows.Count, Rng.Columns.Count) = Rng.Value
- End With
- Next
- .Close
- End With
- End Sub
- Function ThisFile() As String
- With Wb '**«ü©wªºXLS¾×
- ThisFile = Mid(.Path, 1, InStrRev(.Path, "\")) '**«ü©wªºXLS¾×ªº¤W¼h¸ê®Æ§¨
- With .Sheets("Sheet1")
- ThisFile = ThisFile & .Range("b2") & "\" & .Range("c2") & ".CSV" '¤W¼h¸ê®Æ§¨+¤l¸ê®Æ\ªºCSVÀɮק¹¾ã¸ô®|
- '**** ÀˬdCSVªºÀɮ׬O§_¦s¦b
- If Dir(ThisFile) = "" Or Application.CountA(.Range("E2:F3")) <> 4 Then ThisFile = "½ÐÀˬd" & vbLf & Join(Application.Transpose(Application.Transpose([B1:F1])), ",")
- End With
- End With
- End Function
½Æ»s¥N½X |
|