ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¨Ï¥ÎVAB«ö¶s§¹¦¨¸ê®Æ

¨Ï¥ÎVAB«ö¶s§¹¦¨¸ê®Æ

VAB§Ú¦bÁپDzߤ¤¡A©Ò¥H¤£¬O«ÜÀ´
¦ý«æ­¢¦b¤u§@¤¤(¨C¤Ñ)¨Ï¥ÎÀWÁc¥u¦n¤W¨Ó¨D±Ï¡A½Ð¨D·|ªº¤j¤jÀ°§Ú

·Q¨Ï¥ÎVAB«ö¶s§¹¦¨¸ê®Æ

ALL.zip (23.1 KB)

¦^´_ 1# koala2099
all-a.zip (25.81 KB)
  1. Private Sub cbLdData_Click()
  2.   Dim iI%
  3.   Dim sSh$(0 To 1)
  4.   Dim lRow&, lRows&
  5.   Dim vFs, vF
  6.   
  7.   sSh(0) = "s"
  8.   sSh(1) = "e"
  9.   For iI = 0 To 1
  10.     With Sheets(sSh(iI))
  11.       .Activate
  12.       .Cells.ClearContents

  13.       Set vFs = CreateObject("Scripting.FileSystemObject")
  14.       Set vF = vFs.OpenTextFile(ThisWorkbook.Path & "\" & sSh(iI) & ".csv", 1, -2) ' ¨Ï¥Î¨t²Î¹w³]®æ¦¡¶}±Ò°ßŪ¤å¦rÀÉ®×
  15.       lRow = 1
  16.       Do While Not vF.AtEndOfStream
  17.         With .Cells(lRow, 1)
  18.           .Value = vF.readline
  19.           .TextToColumns Comma:=True
  20.         End With
  21.         lRow = lRow + 1
  22.       Loop
  23.       vF.Close
  24.       .Range(.[A2], .[B2]).Insert shift:=xlShiftDown
  25.       lRow = 2
  26.       lRows = 2
  27.       Do While .Cells(lRows, 3) <> ""
  28.         If .Cells(lRows, 1) <> "" Then
  29.           .Rows(lRows).Cut
  30.           .Cells(lRow, 1).Insert
  31.           lRow = lRow + 1
  32.         End If
  33.         lRows = lRows + 1
  34.       Loop
  35. On Error GoTo LdDataErr
  36.       .[A1].SortSpecial key1:=.[A1], Header:=xlYes
  37.       lRows = 2
  38.       Do While .Cells(lRows, 1) <> ""
  39.         lRows = lRows + 1
  40.       Loop
  41.       .Rows(lRows & ":" & Rows.Count).Delete
  42.     End With
  43.   Next iI
  44. On Error GoTo 0
  45. Exit Sub
  46.   
  47. LdDataErr:
  48.   Select Case Err.Number
  49.     Case 1004
  50.       Resume Next
  51.     Case Else
  52.       MsgBox "µo¥Í¿ù»~, ¿ù»~¥N½X : " & Err.Number & "  ,¿ù»~­ì¦] : " & Err.Description
  53.       Exit Sub
  54.   End Select
  55. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# luhpro


    :victory: «z~~~¦n·P°Ê­ò!¥H«á¤u§@¥i¥H¥[§Ö³\¦h¤F¡A«D±`ÁÂÁ±z:loveliness:

¥i§_¦b½Ð±Ð­YÀÉ®×S¤ÎE¬O.xls¡A³æ¯Â¥u­n§âS.xls¤u§@ªíS¡BE.xls¤u§@ªíE¤ºªº¸ê®Æ
¤À§O½Æ»s¨ìALL.xls¤u§@ªíS¤ÎE¤S¸Ó¦p¦ó³B²z
(¦³®É·|¦³3~5­Ó.xlsªº¤u§@ªí)­n½Æ»s¨ìALL­ì¦³¤u§@ªí¸Ì
¦]¬°ALL.xls¸Ì§Ú³]¦³¤@­ÓSUMIF²Î­p¥þ³¡¼Æ¾Úªí®æ
¦³¦bºô¸ô¤W§ä¨ì³£¬O·s¼W·sªº¤u§@ªí
¤£¬O§â¸ê®ÆÂлs¨ì§Ú­ì¦³¤u§@ªí¸Ì
©Ò¥H§Ú¥ÎSUMIFªº³sµ²¥þ¥Î¤£¤W¤S­n­«³s
¥i§_¦A½Ð±zÀ°À°§Ú:$

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2013-10-31 19:48 ½s¿è

¦^´_ 3# koala2099
  1. Sub nn()
  2.   Dim iI%
  3.   Dim sSh$(0 To 1)

  4.   sSh(0) = "S"
  5.   sSh(1) = "E"
  6.   For iI = 0 To 1
  7.     With Workbooks.Open(ThisWorkbook.Path & "\" & sSh(iI) & ".xls")
  8.       .Sheets(sSh(iI)).Cells.Copy Me.Parent.Sheets(sSh(iI)).[A1]
  9.       .Close SaveChanges:=False
  10.     End With
  11.   Next iI
  12. End Sub
½Æ»s¥N½X
µù : 1. µ{¦¡­n»P E.xls(¤º¦³ Sheets("E")) ¤Î S.xls(¤º¦³ Sheets("S")) <- ¦¹§Y­n Copy ªº¸ê®ÆSheet ¨â­ÓÀɮשñ¦b¦P­Ó¥Ø¿ý¤U.
      2. ¦b¤W­zµ{¦¡©Ò¦bªºÀɮפ¤,S »P E ¨â­Ó Sheet ¥²¶·¦s¦b, §_«h·|µo¥Í¿ù»~.
      3. ½Ð¯d·N -  ¦b¤W­zµ{¦¡©Ò¦bªºÀɮפ¤ªº S »P E ¨â­Ó Sheet ªº©Ò¦³¸ê®Æ·|¥þ³¡³QÂл\±¼.
      4. ¦pªG¨C¦¸³£­n½Æ»s¨ì¦P¤@­Ó Sheet ¤º, ¥u­n§ï²Ä 9 ¦æ:
      .Sheets(sSh(iI)).Cells.Copy Me.Parent.Sheets("¥ØªºSheetªº¦WºÙ")).[A1]

TOP

¦^´_ 4# luhpro


ÁÂÁÂ~°ÝÃD¬O¸Ñ¨M¤F!
¥u¬O¦³¨Ç¤£«K¡A¦]¬°¤U¸üªº¸ê®ÆSheets¦W¤£¦P
Áٻݥý¤@¤@¶}±ÒÀÉ®×±N E.xls¤ÎS.xls(¤ºSheets­«·s©R¦W¬°("E")) ¡B S.xls(¤º Sheets­«·s©R¦W¬°("S")) ....
¦³®É­n¶×E.xls¡BS.xls¡BA.xls¡BB.xls¡BC.xls....  ;P
¥»·Q±qXML¸ê®Æ¶×¤J¦A«ö¥kÁä­«·s¾ã²z¡A¥u¬O¤£ª¾¹D¬°¤°»ò©Ò¶×¤Jªº¸ê®Æ¬O[¤å¦r]«D[¼Æ¾Ú]¾É­PSUMIFµLªk¥[Á`
:dizzy: ©Ò¥H³£¥Î¤â°Ê¤@­Ó¤@­Ó½Æ»s¶K¤W­È
«D±`ÁÂÁ±zªºÀ°¦£~¨¯­W¤F3Q^^

TOP

¦^´_ 5# koala2099
¦pªG½T©w¥ØªºÀɮ׳£«Ü³æ¯Â¥u¦³¤@­Ó Sheet ¨º²Ä 9 ¦æ¥i¥H§ï¦¨ :

.Sheets(1).Cells.Copy Me.Parent.Sheets(sSh(iI)).[A1]

§Y¥i.

TOP

¦^´_ 6# luhpro
¶¶§Q¸Ñ¨M¤F  «D±`ÁÂÁ±zªºÀ°¦£¡AÅý§Ú³oµæ¥d¯à§ó¶¶§Q§¹¦¨¤u§@~ÁÂÁÂ^^
Sub A()
  Dim iI%
  Dim sSh$(0 To 2)

  sSh(0) = "S"
  sSh(1) = "T"
  sSh(2) = "E"

    For iI = 0 To 2
    With Workbooks.Open(ThisWorkbook.Path & "\" & sSh(iI) & ".xls")
        .Sheets(1).Cells.Copy ThisWorkbook.Sheets(sSh(iI)).[A1]
      .Close SaveChanges:=False
    End With
  Next iI
  
End Sub
¥t¨ä¤¤¦³Àɮ׬O.csv°ÑÂø¦b¸Ì­±«¨??

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD