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

¦³°ª¤â¥i¥HÀ°§Ú²¤Æ¤@¤U¶Ü?

¦³°ª¤â¥i¥HÀ°§Ú²¤Æ¤@¤U¶Ü?

§Ú°µ¤F¤@­Ó²³æªº²Î­pµ{¦¡,¹ï¤ñ¤U"A2"ªº¤º®e¸ò"A3"ªº¤º®e¬O§_¤@­P,¦pªG¬Oªº¸Ü,¨º»ò"B2"¸ò"B3"ªº¼Æ­È´N·|¬Û¥[,¤§«á"A3"¸ò"B3"´N·|§R°£,¦pªG¬O"§_"ªº¸Ü´N¦V¤U¤@®æ,¸ê®Æ¤Öªº¸ÜÁÙ¦n,¦p§x¸ê®Æ¦h¹L500¤§«á´N·|«D±`ªººC(«Ü¦³¥i¯à§Úªº¹q¸£¤Ó¤F),¦b§Ú¦³¿ú´«·s¹q¸£¤§«e,¦³°ª¤â¥i¥HÀ°§Ú²¤Æ¤@¤U¶Ü?ÁÂÁÂ!!
  1. Sub Test()
  2. Dim z As Integer
  3. z = 2

  4. Do While Range("A" & z).Value <> ""

  5. If Range("A" & z).Value = Range("A" & (z + 1)).Value Then
  6.    Range("B" & z).Value = Range("B" & z).Value + Range("B" & (z + 1)).Value
  7.        Range("A" & (z + 1), "B" & (z + 1)).Delete Shift:=xlUp
  8. Else
  9.     z = z + 1
  10.    
  11. End If

  12. Loop

  13. If Range("A2").Value = "-" Then Range("A2:B2").Delete Shift:=xlUp

  14. End Sub
½Æ»s¥N½X
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

«z~~!!¦n¼F®`°Ú~~!!¯uªº§Ö«Ü¦h,¤£¹L¤p§Ì¤ñ¸û²Â,¦³«Ü¦h«ü¥O³£¬Ý¤£©ú¥Õ,¤j¤j¤¶·Nµ¹§Ú¤¶²Ð¤@¤U¥\¯à¸ò­ì²z¶Ü?ÁÂÁÂ!!
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

  1. Sub Test()
  2. Dim a, d As Object, i&
  3. a = Range([A2], [b65536].End(3))
  4. Set d = CreateObject("Scripting.Dictionary")
  5. For i = 1 To UBound(a)
  6. d(a(i, 1)) = d(a(i, 1)) + a(i, 2)
  7. Next
  8. Range([A2], [b65536].End(3)) = ""
  9. [A2].Resize(d.Count, 1) = Application.Transpose(d.keys)
  10. [b2].Resize(d.Count, 1) = Application.Transpose(d.items)
  11. If [A2] = "-" Then [A2:B2].Delete (2)
  12. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD