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

¦p¦ó°µ¸ó­¶¥X³f³æ¾ú¥v²Î­p

¦p¦ó°µ¸ó­¶¥X³f³æ¾ú¥v²Î­p

1.¦p¦ó¦b¥X³f³æ¾ú¥v²Î­pªí¤¤Åã¥Ü¥X³f³æ¸ê®Æ

2.¥X³f³æ  ²Î­p§¹«á·í¤éÁÙ¥iÄ~Äò¿é¤J²Ä2µ§¤£¦P«È¤áªº¸ê®Æ  ¤]·|Ä~ÄòÅã¥Ü¦b¥X³f³æ¾ú¥v²Î­pªí¤¤

­n¦p¦ó¤~¯à°µ¥X¨Ó£z

¥X³f³æ¾ú¥v²Î­p.rar (3.3 KB)

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-5-8 20:01 ½s¿è

¦^´_ 1# janejacky

§ó¥¿:
¸Õ¸Õ¬Ý
  1. Sub Ex()
  2.     Dim D(2) As Object, R As Variant, AR()
  3.     Set D(0) = CreateObject("Scripting.Dictionary")
  4.     Set D(1) = CreateObject("Scripting.Dictionary")
  5.     Set D(2) = CreateObject("Scripting.Dictionary")
  6.     With Sheets("¥X³f³æ")
  7.         For Each R In .Range(.[B12], .[G29]).Rows   '¥X³f³æ¤º®e½d³ò-> ªº¾ã¦C
  8.             If Application.CountA(R) = 6 Then   '¸ê®Æ­n»ô¥þ
  9.                 AR = Array(.[G4].Text, .[G5], .[B5], R.Cells(1, 1), R.Cells(1, 2), R.Cells(1, 3), R.Cells(1, 5), R.Cells(1, 6))
  10.                 D(1)(Join(AR, ",")) = AR
  11.             End If
  12.         Next
  13.     End With
  14.     With Sheets("¥X³f³æ¾ú¥v²Î­p")
  15.         For Each R In .Range(.[A3], .Cells(Rows.Count, "H").End(xlUp)).Rows
  16.             If Application.CountA(R) = 8 Then D(0)(Join(Application.Transpose(Application.Transpose(R.Value)), ",")) = ""
  17.             D(2)(R.Cells(1, 1) & R.Cells(1, 2)) = D(2)(R.Cells(1, 1) & R.Cells(1, 2)) + R.Cells(1, 8)
  18.         Next
  19.         For Each R In D(1).KEYS
  20.             If D(0).EXISTS(R) = False Then
  21.                 With .Cells(Rows.Count, "A").End(xlUp).Offset(1)
  22.                     .Resize(, 8) = D(1)(R)
  23.                     D(2)(.Cells(1) & .Cells(1, 2)) = D(2)(.Cells(1) & .Cells(1, 2)) + .Cells(1, 8)
  24.                 End With
  25.             End If
  26.         Next
  27.         For Each R In .Range(.[A3], .Cells(Rows.Count, "A").End(xlUp))
  28.             If D(2).EXISTS(R & R(1, 2)) Then R(1, 9) = D(2)(R & R(1, 2))
  29.         Next
  30.     End With
  31.     Set D(0) = Nothing
  32.     Set D(1) = Nothing
  33.     Set R = Nothing
  34. End Sub
½Æ»s¥N½X

TOP

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2011/5/8 20:02): ¤w­×¥¿

§Ú¸Õ¹L
¦ý«È¤á¦WºÙ¨S¦³¨ì¥X³f²Î­pªí¤¤£®

TOP

¦^´_ 1# janejacky


    ¸Õ¸Õªþ¥ó
¥X³f³æ¾ú¥v²Î­p.rar (12.57 KB)
  1. Sub inputdata() 'Àx¦s¸ê®Æ
  2. Dim Rng As Range, Ay()
  3. With Sheet1
  4. Set Rng = .Range("A12:A29")
  5. If Application.CountA(Rng) > 0 Then
  6.    For Each a In Rng.SpecialCells(xlCellTypeConstants)
  7.       ar = Array(.[G5].Value, .[G4].Value, .[B5].Value, a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, a.Offset(, 5).Value, a.Offset(, 6).Value)
  8.       ReDim Preserve Ay(s)
  9.       Ay(s) = ar
  10.       s = s + 1
  11.    Next
  12.    cnt = .[G32].Value
  13.    With Sheet2
  14.       Set a = .[A65536].End(xlUp).Offset(1)
  15.       a.Resize(s, 8) = Application.Transpose(Application.Transpose(Ay))
  16.       a.Offset(s - 1, 8) = cnt
  17.    End With
  18. End If
  19. End With
  20. End Sub
  21. Function PaperNo(Rng As Range, mydate As Date, k) '¬y¤ô½s¸¹
  22. Set d = CreateObject("Scripting.Dictionary")
  23. mystr = Format(mydate, "yyyymmdd")
  24. If Application.CountA(Rng) > 0 Then
  25. For Each a In Rng.SpecialCells(xlCellTypeConstants)
  26.     If Left(a, 8) = mystr Then d(Val(a)) = ""
  27. Next
  28. End If
  29. If d.Count > 0 Then
  30. PaperNo = IIf(k = 1, Format(Application.Max(d.keys) + 1, "00000000000"), Format(Application.Max(d.keys), "00000000000"))
  31. Else
  32. PaperNo = mystr & "001"
  33. End If
  34. End Function
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¤Sµo²{¤£¶¶

¥»©«³Ì«á¥Ñ janejacky ©ó 2011-5-10 15:55 ½s¿è

¯u¬OÁÂÁÂ
ÁÙ­n¦h¾Ç¾Ç
:$

¤Sµo²{¤£¶¶
¥X³f³æªº³æ¸¹¦p¦ó¤@¼Ë¦P¤@¤Ñno.¤]³£¥u¦³¤@­Ó
³æ¸¹·|¤@¼Ë ©Ò¥H¥X²{ªº¥X³f³æ¾ú¥v²Î­p¤WÁ`ÃB¤]·|¨Ì¾Ú¤W¤@±iªºÁ`ÃB
½Ð°Ý­n¦p¦ó«ç»ò³B²z?

ÁÙ¦³§Ñ°O¦³¤@­Óµ|ÃB¥¼¥[¤W¥h
½ÐÀ°¦£
ÁÂÁÂ

¥X³f³æ¾ú¥v²Î­p(01).rar (10.83 KB)

TOP

  ¤Sµo²{°ÝÃD¤F

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD