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

[µo°Ý] ¹B°Ê·|ÄvÁɹD¦¸ÀH¾÷¤À²Õ

¦^´_ 19# ­ã´£³¡ªL


    ÁÂÁ«e½ú
¥H¤U¤ß±oµù¸Ñ½Ð«e½ú¦A«ü¾É,ÁÂÁÂ

Sub ­«¸m¸ê®Æ()
Dim R&
'¡ô«Å§iÅܼÆ!R¬Oªø¾ã¼ÆÅܼÆ
R = [m65536].End(3).Row
'¡ô¥OR³oªø¾ã¼ÆÅܼƬO MÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ¦C¸¹
If R < 2 Then Exit Sub
'¡ô¥O¦pªGRÅÜ¼Æ < 2 !´Nµ²§ôµ{¦¡°õ¦æ
Application.ScreenUpdating = False
'¡ô¥O¿Ã¹õ¼È¤£ÀHµ{¦¡°õ¦æ§@ÅܤÆ
With Range("m2:p" & R)
'¡ô¥H¤U¬OÃö©ó[M2]¨ì PÄæ²Ä RÅܼƦC,³o½d³òÀx¦s®æªºµ{§Ç
     .Columns(3) = "=IF(M2="""",999,COUNTIF(M$1:M2,M2))"
     '¡ô¥O³o½d³ò¤º¬Û¹ïÄæ¦ìªº²Ä3Äæ(OÄæ)­È¬O (¤½¦¡)¦r¦ê
     '¤½¦¡:¦pªGM2¬OªÅ¦r¤¸ªº±ø¥ó¦¨¥ß,´NÅã¥Ü 999,
     '§_«h´N­pºâMÄæ«e´X¦C¸Ì ¦³´X­Ó(·í¦CMÄæ¬Û¦P¦r¦ê)

     .Sort Key1:=.Item(3), Order1:=xlAscending, Header:=xlNo
     '¡ô¥O¸ê®Æ¥HOÄæ°µ¨S¦³¼ÐÃD¦Cªº¶¶±Æ§Ç
     .Columns(3) = ""
     '¡ô¥O³o½d³ò¤º¬Û¹ïÄæ¦ìªº²Ä3Äæ(OÄæ)­È¬O ªÅ¦r¤¸
     .Columns(4) = "=INT((ROW(A1)-1)/K$3)+1"
     '¡ô¥O³o½d³ò¤º¬Û¹ïÄæ¦ìªº²Ä4Äæ(PÄæ)­È¬O (¤½¦¡)¦r¦ê,
     '¤½¦¡:«e¤@¦C¸¹´î1«á°£¥H[K3]Àx¦s®æ­È,¦A¥h°£¤p¼ÆÂà¤Æ¬°¾ã¼Æ,³Ì«á+1
     '¥Î«e¤@¦C¸¹°£ªº·N¸q¬O:¤£·|¾ã°£,´N¤£¥²¾á¤ß¾ã°£¤£¥[ 1ªº°ÝÃD,ÁÂÁ«e½ú

     .Columns(4) = .Columns(4).Value
     '¡ô¥O³o½d³ò¤º¬Û¹ïÄæ¦ìªº²Ä4Äæ(PÄæ)­È¬O ¦Û¨­¤½¦¡­pºâ­È
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 20# ymes


¤@¡B­ì¥»A:CÄæ¤À§O¬°¯Z¯Å¡B©m¦W¡B¶µ¥Ø¡A·Q§ï¦¨¨úA:DÄæ¡A¤À§O¬°¶µ¥Ø¡B¯Z¯Å¡B©m¦W¡B¾Ç¸¹¡A­n«ç»ò§ï°Ê©O¡H
__¬Ý¨Ó³oÁÙ¬O¯óº`ª©¥», ¤@¯ë¾Ç¸¹·|©ñ¦b©m¦W«e­±§a!  
__¶µ¥Ø¦WºÙªº"¨k¥Í/¤k¥Í"©T©w©ñ«á­±? ¥B¥u¦³Áɶ]¶µ¥Ø?
__³Ì¦nµ¹§¹¾ã"©w®×ª©", ½×¾Âµ¹ªº¬O¸Ñ¨M¤è®×¦Ó¤£¬O¥N¤u, ¦Û¤v­n¯à¦Û¦æ§ó§ïµ{¦¡ªº

¤G¡B¥i¥H°µ­Ó¤À²Õ¶s¡AÅý¤@Á䧹¦¨ÀH¾÷¤À²Õ¶Ü¡H³o¼Ë´N¤£¥Î¨ì¦U¤À­¶¤@¤@¥h«ö¤À²Õ¶s¤F
__¤@¦¸¦U¤À­¶¦Û°Ê§¹¦¨¬O¥i¥H, ¦ý¥²¶·¦Û¤v­n¥ý«Ø¥ß©Ò»Ý¤Àªí, ¨Ã¿é¤J¥²­nªº°Ñ¼Æ
__¦U¤Àªí³£­n¦A¦¸¤H¤uÀˬdÅçÃÒ¥¿½T©Ê, ¨º»ò­Ó§O³æ­¶°õ¦æ¤]¨SÔ£®t§O(¤Ï¥¿³æ­¶°õ¦æ¨Ã¤£¤Óªá®É¶¡)

¤T¡B¦U³æ¶µÄvÁÉL:NÄæ­ì¥»¦³ÅçÃÒ¸ê°T¡A¥i¥H¹³ ­ã´£³¡ªL¤j¤j¯ë¡A¥[¤W¤À°tªº²Õ§O¤Î¹D¦¸¶Ü¡H
__L:NÄæ"­ì¥»"¦³ÅçÃÒ¸ê°T---ªþ¥ó¨S¦³¬Ý¨ì¨º"­ì¥»"¸ê®Æ??? ¨º¨Óªº?

¤½¦¡+VBA+¤u§@ªí°ò¥»¾Þ§@.....¦³®É§ó¦³§Q©óªí®æªº»s§@¤Î³B²z, ¤£¯à°¾¼o!!!

TOP

¦^´_ 21# ymes


    ÁÂÁ ­ã´£³¡ªL«e½ú«ü¾É,ÁÂÁ«e½ú¤@°_¾Ç²ß
¥H¤U¬O¤ù¬q¾Ç²ß¤ß±oµù¸Ñ,¥ý´£¨Ñµ¹«e½ú°Ñ¦Ò
¦¹¬q¤ß±o­«ÂI¦b©ó:¥Î¦P¤@°}¦CÂo¥X²Å¦X±ø¥óªº¸ê®Æ,ºë½Tªº±N¸ê®Æ©ñ¤J¥Ø¼ÐÀx¦s®æ¤¤

Option Explicit
Sub A_¸ü¤J¸ê®Æ()
Dim Arr, TC$, T$, i&, N&
'¡ô«Å§iÅܼÆ!Arr¬O³q¥Î«¬ÅܼÆ,(TC,T)¬O¦r¦êÅܼÆ,(i,N)¬Oªø¾ã¼ÆÅܼÆ
Call C_²M°£
'¡ô°õ¦æ(C_²M°£)°Æµ{¦¡
TC = [k2]
'¡ô¥OTC³o¦r¦êÅܼƬO [k2]Àx¦s®æ­È
If TC = "" Then MsgBox "¡¯¥¼¿é¤J¶µ¥Ø¦WºÙ¡I¡@": Exit Sub
'¡ô¦pªGTCÅܼƬO ªÅ¦r¤¸!´N¸õ¥X´£µøµ¡~~,«ö½T»{«á§Yµ²§ôµ{¦¡°õ¦æ
Application.ScreenUpdating = False
'¡ô¥O¿Ã¹õ¼È¤£ÀHµ{¦¡°õ¦æ§@ÅܤÆ
Arr = Range([³ø¦Wªí!c1], [³ø¦Wªí!a65536].End(3))
'¡ô¥OArr³o³q¥Î«¬ÅܼƬO¤Gºû°}¦C,¥H"³ø¦Wªí"¤u§@ªí[C1]¨ìAÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ,
'³o½d³òÀx¦s®æ­È­Ë¤J°}¦C¤¤

For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é!i±q2¨ìArr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
    If Arr(i, 3) = TC Then
    '¡ô¦pªGi°j°é¦C²Ä3ÄæArr°}¦C­È¬O TCÅܼÆ??
       N = N + 1
       '¡ô¥O³oNªø¾ã¼ÆÅܼƲ֥[ 1
       Arr(N, 1) = Arr(i, 1)
       '¡ô¥ONÅܼƦC²Ä1ÄæArr°}¦C­È¬O i°j°é¦C²Ä1ÄæArr°}¦C­È
       Arr(N, 2) = Arr(i, 2)
       '¡ô¥ONÅܼƦC²Ä2ÄæArr°}¦C­È¬O i°j°é¦C²Ä2ÄæArr°}¦C­È
    End If
Next i
If N = 0 Then MsgBox "¡¯¨S¦³²Å¦X¶µ¥Ø¸ê®Æ¡I¡@": Exit Sub
'¡ô¦pªGNÅܼƬO 0!´N¸õ¥X´£¥Üµ¡~~,«ö½T»{«á§Yµ²§ôµ{¦¡°õ¦æ
[m2].Resize(N, 4).Value = Arr
'¡ô¥O[m2]ÂX®i¦V¤UNÅܼƦC,¦V¥k4Ä檺½d³òÀx¦s®æ­È¥HArr°}¦C­È­Ë¤J
Call ­«¸m¸ê®Æ
'¡ô°õ¦æ(­«¸m¸ê®Æ)°Æµ{¦¡
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-2-11 08:38 ½s¿è

¦^´_ 21# ymes


    ÁÂÁ«e½úÄ~Äò¤@°_¾Ç²ß

1.«á¾Ç·Qªk¤£¤@¼Ë:¤½¦¡¬OVBA´¼¼zªººëµØ¿@ÁY,¬O«á¾Ç¾Ç²ßEXCELªº¨½µ{¸O,«Øij²ö©¿µø¤½¦¡
2.«e½ú·P¨ü¨ìVBAªº¦n³B,¥H«á±`¤W½×¾Â¤@°_¾Ç²ß,Åý§ó¦h¨Æ¥i¥H¨Æ¥b¥\­¿
3.«e½ú³°Äò¼W¥[¶µ¥Ø»P³W«h,·Q¥²³Ì²×ª©¥»¥¼©w®×,¥H©¹¬°¦P¨Æ³]­p½ÆÂøÂIªºªí®æ³£­n¶}·|°Q½×,
°Q½×¦U¤è´£¥Xªº·N¨£,°µ¥X³Ì«áªº©w®×
4.«á¾Çªº¸gÅç¬Oµ{¦¡¹çÄ@¼g¤j¤@ÂI¼s¤@ÂI,«áÄò°µ¤p­×§ï,¦pªG±ø¥ó¹³«e½úªº±¡¹Ò¤@ª½Åܧó,µ{¦¡±`±`­n¤j§ï©Î¥´±¼­«¼g,
±`±`§ï±ø¥ó¹ï¾Ç²ß¤¤ªº«á¾Ç¬O«Ü¦nªº¾Ç²ß¾÷·|,±`±`ÅÜ«äºû,¿i­@¤ß,ÁÂÁ«e½ú
5.¦pªG«e½úªº»Ý¨D¬O«Ü«æ­¢ªº!«Øij«e½ú¥ý§ä¥i³Ì²×©w®×ªº¹Î¶¤¤@°_°Q½×¥X³Ì²×ª©¥»,½×¾Â¸Ì«Ü¦h¼F®`ªº«e½ú¥i¥H«ü¾É
6.¦pªG»Ý¨D¤£«æ!³°Äò¦A´£¥X¤£¦P»Ý¨D°Q½×¾Ç²ß¤]¬O«Ü¦nªº¤è¦¡
7.«á¾Ç©ß¿j¤Þ¥É,,¥i¥H±o¨ì«e½ú­Ìªº«ü¾É,³Ì¤jªº·N¸q¬O§Æ±æ§ó¦h¤H¤@°_¾Ç²ß

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 19# ­ã´£³¡ªL


    ÁÂÁ±z´£¨Ñ¥t¤@­Ó·Qªk¡Avba¯uªº¤£·|¡A¦ý¬Ý¨ìvba³o»ò¤è«K¡A³£Ãi±o¼g¤½¦¡¤F¡K¡K
~¬Q¤éºØºØ¡AÄ´¦p¬Q¤é¦º~
~¤µ¤éºØºØ¡AÄ´¦p¤µ¤é¥Í~

TOP

¦^´_ 16# Andy2483


¤£¦n·N«ä¡A¦]¬°¯uªº¤£À´vba¡A©Ò¥H¥i¯à°Ê¤F¨Ç¦Û¥H¬°¬Oªº¦a¤è¡A¥i¯àÅý±z§xÂZ¡A»¡Án©êºp¤F¡I

ÁöµM  ­ã´£³¡ªL¤j¤j»¡¥Î¤½¦¡+vba¥i¸Ñ¨M¥H¤U§xÂZ¡A¦ýÁÙ·Q»¡°Ý°Ý¬Ý¡G

¤@¡B­ì¥»A:CÄæ¤À§O¬°¯Z¯Å¡B©m¦W¡B¶µ¥Ø¡A·Q§ï¦¨¨úA:DÄæ¡A¤À§O¬°¶µ¥Ø¡B¯Z¯Å¡B©m¦W¡B¾Ç¸¹¡A­n«ç»ò§ï°Ê©O¡H

¤G¡B¥i¥H°µ­Ó¤À²Õ¶s¡AÅý¤@Á䧹¦¨ÀH¾÷¤À²Õ¶Ü¡H³o¼Ë´N¤£¥Î¨ì¦U¤À­¶¤@¤@¥h«ö¤À²Õ¶s¤F

¤T¡B¦U³æ¶µÄvÁÉL:NÄæ­ì¥»¦³ÅçÃÒ¸ê°T¡A¥i¥H¹³ ­ã´£³¡ªL¤j¤j¯ë¡A¥[¤W¤À°tªº²Õ§O¤Î¹D¦¸¶Ü¡H

¦A¦¸°J¤ß·PÁ±zªºÀ°¦£¡I

¹B°Ê·|¤À²Õªí20230210-1.zip (58.64 KB)

~¬Q¤éºØºØ¡AÄ´¦p¬Q¤é¦º~
~¤µ¤éºØºØ¡AÄ´¦p¤µ¤é¥Í~

TOP

§ï¤U//³Ì«á¤@²ÕµL¶¡¹j//
Xl0000208-2.rar (39.29 KB)

TOP

¦^´_ 17# ­ã´£³¡ªL


    ÁÂÁ«e½ú«ü¾É,«á¾Ç¬ã¨s¤@¤U
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2023-2-10 15:56 ½s¿è

¤½¦¡+±Æ§Ç+vba//
Xl0000208-1.rar (35.24 KB)

­Y¥¼¥Xµ²ªG..¦A¸Õ´X¦¸..­Y³£¸Õ¤£¥X¨Ó, ¥i¯à¸ê®Æµ²ºcµLªk°µ¥X¤À²Õ(¦P¤@¯Z¤£¯à¦P¹D, ¬O¹DÃö¥d)~~

__§ó¥¿:³Ì«á¤@²Õ¥i¯à¥¼º¡¤H¼Æ, ¹D¦¸·|¦³»~®t, ¥HªÅ®æ¶ñ¤J
      ³Ì«á¤@²Õ¤H¼Æ¤£¨¬®É, ¤£·|¥Ñ1~?¶¶§Ç±Æ¦C, ·|¦³¶¡¹j

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-2-10 14:42 ½s¿è

¦^´_ 15# ymes


    ÁÂÁ«e½ú,«á¾ÇÀrÆj§Þ½a¤F,½Ð«e½ú­Ì«ü¾É
¤£ª¾«e½ú§ï°Ê¦h¤Öµ{¦¡½X?

½Ð±N¤U¦C¬õ¦r·s¼W©Î¨ú¥N, ©Î ¤W¶Ç«e½ú³Ì·s½d¨Ò

Option Explicit
Dim ²Õªí®æ As Range, R&, C%
Sub ¶}©l¤À²Õ()
Dim Drr, Brr, Crr, Y, ¶Ã¼Æ&, ¤H¼Æ&, ¹D¼Æ&, ²Õ¼Æ&, °õ¦æ¼Æ&, ¶]¹D¼Æ&, i&
Dim ¶µ¥Ø$, Arr(1 To 1000, 1 To 3), n&, ²Õ§O, xR As Range
¶µ¥Ø = Split(ActiveSheet.Name, "(")(0)
¶]¹D¼Æ = [A2].End(xlDown).Row - 2
Drr = Range([³ø¦Wªí!C2], [³ø¦Wªí!A65536].End(3))
For i = 1 To UBound(Drr)
   If Drr(i, 3) Like ¶µ¥Ø & "*" Then
      n = n + 1
      Arr(n, 1) = Drr(i, 1): Arr(n, 2) = Drr(i, 2): Arr(n, 3) = Drr(i, 3)
   End If
Next
If n = 0 Then
   MsgBox "¨S¦³¦W³æ!µLªk°õ¦æ": Exit Sub
End If
If ¶]¹D¼Æ < 1 Then
   MsgBox "¶]¹D¼Æ¤£²Å¦X³W«h!µLªk°õ¦æ": Exit Sub
End If
Call ²M°£: [L1].Resize(n, 3) = Arr
¤H¼Æ = n: ReDim Brr(¶]¹D¼Æ - 1, 1)
Head:
Set Y = CreateObject("Scripting.Dictionary")
Do While °õ¦æ¼Æ < ¤H¼Æ
   Randomize: ¶Ã¼Æ = Rnd() * 10000 Mod ¤H¼Æ + 1
   If Y.Exists(¶Ã¼Æ) = Empty Then
      °õ¦æ¼Æ = °õ¦æ¼Æ + 1
      Y(¶Ã¼Æ) = ""
      ¹D¼Æ = °õ¦æ¼Æ Mod ¶]¹D¼Æ
      Y(Arr(¶Ã¼Æ, 1) & "|" & ¹D¼Æ) = ""
      ²Õ¼Æ = IIf(¹D¼Æ, °õ¦æ¼Æ \ ¶]¹D¼Æ + 1, °õ¦æ¼Æ \ ¶]¹D¼Æ)
      Y(Arr(¶Ã¼Æ, 1) & "/" & ²Õ¼Æ) = ""
      Crr = Y(²Õ¼Æ & "/²Õ")
      If Not IsArray(Crr) Then Crr = Brr
      ¹D¼Æ = IIf(¹D¼Æ, ¹D¼Æ, ¶]¹D¼Æ)
      Crr(¹D¼Æ - 1, 0) = Arr(¶Ã¼Æ, 1): Crr(¹D¼Æ - 1, 1) = Arr(¶Ã¼Æ, 2)
      Y(²Õ¼Æ & "/²Õ") = Crr
   End If
   If (Y.Count - ²Õ¼Æ) Mod °õ¦æ¼Æ Then ²Õ¼Æ = 0: °õ¦æ¼Æ = 0: GoTo Head
Loop
'For i = 1 To ²Õ¼Æ - 1: ²Õªí®æ.Copy Cells(i * (R + 1) + 1, 1): Next '³o¦æÂI±¼,·s¼W¤U¦C¬õ¦r
Dim S$, T&
For i = 1 To ²Õ¼Æ - 1
   ²Õªí®æ.Copy Cells(i * (R + 1) + 1, 1)
   T = 3 + ((R + 1) * i)
   S = "=IF(F" & T & "<>0,RANK(F" & T & ",$F$" & T & ":$F$" & T + ¶]¹D¼Æ - 1 & ",1),"""")"
   Cells(i * (R + 1) + 1, 1).Item(3, 7).Resize(¶]¹D¼Æ, 1) = S
Next

For i = 1 To ²Õ¼Æ
   ²Õ§O = "(²Ä" & Application.Text(i, "[DBNum1]0") & "²Õ)"
   Set xR = [B3].Item((i - 1) * (¶]¹D¼Æ + 3) + 1, 1)
   xR.Resize(¶]¹D¼Æ, 2) = Y(i & "/²Õ")
   Set xR = xR.Item(-1, 0)
   xR.Value = Split(xR.Value, "(")(0) & ²Õ§O
Next
End Sub
Sub ²M°£()
Dim uR&
R = [A2].End(xlDown).Row
C = [A2].End(xlToRight).Column
uR = ActiveSheet.UsedRange.Rows.Count
[L:N].ClearContents
[A2].End(xlDown).Item(2, 1).Resize(uR - R, C).Clear
[B3].Resize(R - 2, 2).ClearContents
'·s¼W¤U¦C¬õ¦r
[F3].Resize(R - 2, 1).ClearContents
[G3].Resize(R - 2, 1) = "=IF(F3<>0,RANK(F3,$F$3:$F$" & R & ",1),"""")"

Set ²Õªí®æ = Range([A1], Cells(R, C))
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD