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

[µo°Ý] ¤ñ¸û¸ê®Æ-§Q¥ÎVBAµ{¦¡¤ñ¸û¨â­Ó¸ê®ÆÀɮרðµ­pºâ

¦^´_ 10# Hsieh
¤j¤j¡G
§Úªº¤u§@ªí¬O­è¦n¥u¦³¤T±i¤u§@ªí¡A
¨S¦³²Ä¥|±i¡C

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-3-19 11:01 ½s¿è

¦^´_ 11# amychlo

³o¼Ë´N«ÜÃø§PÂ_¿ù»~¥X¦b­þ¸Ì
¥[¤J©³¤U¬õ¦r³¡¤À¬Ý¬Ý
¦pªGÁÙ¤£¦æ³Ì¦n±N3ÀɮפW¶Ç´ú¸Õ¬Ý¬Ý
Sub ·J¾ã()
Dim Ar()
Set d = CreateObject("Scripting.Dictionary")
fd = ThisWorkbook.Path & "\" '3­ÓÀɮשñ¦b¦P¥Ø¿ý¤¤
'fd="D:\"  '«ü©wA¡BB2Àɮתº¦s©ñ¥Ø¿ý
fs = Array("A.xls", "B.xls")
d("³W®æ") = "¼Æ¶q"
For Each f In fs
   With Workbooks.Open(fd & f)
      With .Sheets(1)
      i = i + 1
      ReDim Preserve Ar(2, s)
      Ar(0, s) = "³W®æ": Ar(1, s) = "¼Æ¶q"
      s = s + 1
      .UsedRange.Copy ThisWorkbook.Sheets(i).[A1]
      With ThisWorkbook.Sheets(i)
          For Each a In .Range(.[B2], .[B2].End(xlDown))
          mystr = Mid(a, 1 / (i / 2))
             If IsEmpty(d(mystr)) Then d(mystr) = a.Offset(, IIf(i = 1, 7, 2)) Else d(mystr) = a.Offset(, IIf(i = 1, 7, 2)) - d(mystr)
             ReDim Preserve Ar(2, s)
             Ar(0, s) = mystr: Ar(1, s) = a.Offset(, IIf(i = 1, 7, 2)).Value
             s = s + 1
          Next
          ThisWorkbook.Sheets(3).[A1].Offset(, (i - 1) * 2).Resize(s, 2) = Application.Transpose(Ar)
          Erase Ar: s = 0
      End With
      End With
      .Close 0
    End With
Next
With Sheets(3)
   .[E1].Resize(d.Count, 1) = Application.Transpose(d.keys)
   .[F1].Resize(d.Count, 1) = Application.Transpose(d.items)
End With
End Sub
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 12# Hsieh
¤j¤j¡G·P®¦§A¡I
¥Ø«e´ú¸Õ¦¨¥\¡C
´N¦p§A©Ò¥[ªº¤@¼Ë¡AOK¤F¡I

TOP

¦^´_ 13# amychlo
³o­ì¦]´N¥X²{¦b¦]¬°¶}±Ò¨Ó·½Àɮ׫á§@¥Îµøµ¡Åܦ¨¨Ó·½ÀÉ®×
¥¼«ü©w¬¡­¶Ã¯ªº¤u§@ªí´N·|«ü¦V¸Ó°µ¥Î¤¤¬¡­¶Ã¯
©Ò¥H·íA©ÎBÀɮרS¦³²Ä3±i¤u§@ªí®É§Y·|¥X²{¦¹¿ù»~
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¤Ñ¤W³Ì¬ü¬O¬P¬P¡A¤H¥Í³Ì¬ü¬O·Å±¡¡C
ªð¦^¦Cªí ¤W¤@¥DÃD