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

VBA¤ñ¹ï¨D¸Ñ

VBA¤ñ¹ï¨D¸Ñ

Dear¦U¦ìª©¤j»P°ª¤â
³oÃ䦳¤@­Ó¤ñ¹ïªº°ÝÃD,·Q½Ð°ª¤âÀ°¦£¼¶¼g,¨ä°ÝÃD¦p¤U¹Ï



´ú¸Õ1.rar (18.39 KB)

¥»©«³Ì«á¥Ñ n7822123 ©ó 2019-6-14 01:41 ½s¿è

¦^´_ 1# peter631114


¦pªG[B2]=[B6]¡A¬O¤£¬O[K5]=[A2] ,[M5]=[A6]

µM«áÄ~Äò¬Ý[B2]¬O§_µ¥©ó[B7]¡A

µ¥©óªº¸ÜÄ~Äò¥Î[B2]¤ñ¤U¤@­Ó[B8]¡Aª½¨ì¤ñ§¹³£¤@¼Ë¡A¦A´«[B3]?

¤£µ¥©óªº¸Ü¡A¸õ¨ì[B3]¥h¸ò¨ä¥Lªº¤ñ

¬O³o­ÓÅÞ¿è?
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2019-6-14 02:28 ½s¿è

¦^´_ 1# peter631114


§Æ±æ§Úªº²z¸Ñ¨S¦³¿ù¡A½Ð¸Õ¸Õ¬Ý§a!

Sub ¤ñ¹ï()
Dim Ri&, Rn&, i&, j&, n&, Arr, Brr
Ri = Cells(Rows.Count, 1).End(3).Row
Arr = [A2].Resize(Ri - 1, 2)
Rn = Ri * (Ri - 1)
If Rn >= Rows.Count Then Rn = Rows.Count - 1
Brr = [K2].Resize(Rn, 3): n = 1
For i = 1 To Ri - 1: For j = 1 To Ri - 1
  If i <> j Then
      If Arr(i, 2) = Arr(j, 2) Then
        Brr(n, 1) = Arr(i, 1)
        Brr(n, 3) = Arr(j, 1)
        n = n + 1
      Else: Exit For: End If
  End If
Next:  Next
[K2].Resize(Rn, 3) = Brr
End Sub
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

Dear Sir
¦p§A©Ò¤F¸Ñ¨S¦³¿ù,§Ú¸Õ¥Î¤F§Aªºcode¶i¦æ´ú¸Õ,µ²ªG¬O¹ïªº~~¥u¬O¥Ø«eµ{¦¡¥u¦³¤ñ¹ï¨ì§PÂ_±ø¥ó¬°0ªº³¡¤À,·í§PÂ_±ø¥ó¬°"1"©Î2¥H«á´N¨S¦³¤ñ¹ï¤F~~

TOP

¦^´_ 4# peter631114


  ¤£¤ÓÀ´§Aªº·N«ä¡A§Úµ{¦¡¶]¥X¨Óªºµ²ªG¡A¸ò§Aªº±Ô­z¬O¤@¼Ëªº



¤ñ¹ï.rar (19.93 KB)
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

Dear Sir

½Ð°Ñ¦Ò¤U¹Ï©Ò¥Ü,µ{¦¡·|¤@ª½§PÂ_,ª½¨ìBÄæ¦ì¬°ªÅ¥Õ¤~·|°±¤î
ÁÂÁ§Aªº¤j¤OÀ°¦£


0614_¤ñ¹ï.rar (18.65 KB)

TOP

Ãþ§O        §PÂ_±ø¥ó
A        0
B        0
C        0
D        2
F        2
G        2
H        0
I        0
J        2
K        2
L        2


³o­n¦p¦ó¤ñ¹ï??

==============

TOP

Dear¤j¤j
½Ð°Ñ¦Ò¤U¹Ï¤ñ¹ïµ²ªG,¸Ô²Ó¤º®e½Ð°Ñ¦Òªþ¥ó

[attachimg]30884 0617¤ñ¹ïµ²ªG.rar (6.79 KB)
[/attachimg]

Snap3.jpg (106.27 KB)

Snap3.jpg

TOP

¦^´_ 8# peter631114


Sub TEST()
Dim Arr, Brr, i&, j&, N&
Arr = Range([B1], Cells(Rows.Count, 1).End(xlUp))
ReDim Brr(1 To 20000, 1 To 3)
For i = 2 To UBound(Arr)
    For j = 2 To UBound(Arr)
        If i <> j And Arr(i, 2) = Arr(j, 2) Then
           N = N + 1
           Brr(N, 1) = Arr(i, 1)
           Brr(N, 3) = Arr(j, 1)
        End If
    Next j
Next i
If N = 0 Then Exit Sub
[F2:H2].Resize(N) = Brr
End Sub

Xl0000362.rar (12.25 KB)


======================

TOP

ÁÂÁ¤j¤jªºÀ°¦£,·P®¦³á

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD