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

Excel VBA ½Ð¯q II

Excel VBA ½Ð¯q II





AAªí³æC1¬°¤U©Ô¦¡¿ï³æ¡A¸Ì­±¦³¤T­Ó¹Ï¥Ü·Q°µ¦¨«ö¶s¡A¤À§O¹ïÀ³QQªí³æªºT1 & T2 & T3¸ê®Æ¡C
¥D­n¬O¤µ¤Ñ·Q¦bQQªí³æªºT1¸ê®Æ¡A¿é¤J¼Æ¾Ú¡AµM«á¥u­n±qAAªí³æ«öT1ªº«ö¶s¡A´N¯àª½±µ¿é¤J¼Æ¾Ú¡A¦Ó¤£¥²¸õ¨ìQQªí³æ¤ºµM«á¿é¤J¸ê®Æ¡C

¦b¦¹´£¨ÑÀɮסC
BTT.rar (26.55 KB)

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-31 15:07 ½s¿è

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß8#¼Ó½d¨Ò¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð

AAªí°õ¦æ«e:


¸ü¦ÜAAªí_°õ¦æµ²ªG:


AAªí_¨Ï¥ÎªÌ°õ¦æÀx¦s®æ½s¿è:


¼g¤JQQªí_°õ¦æµ²ªG:



Option Explicit
Public K%
Sub TEST()
Dim Qrr, Arr, Y, Z, i&, j&, T1$, T2$, TT$
Dim Q As Range, A As Range, Shq As Worksheet, Sha As Worksheet
Set Y = CreateObject("Scripting.Dictionary")
Set Sha = Sheets("AA"): Set Shq = Sheets("QQ")
Set Q = Range(Shq.[A1], Shq.UsedRange): Qrr = Q
For i = 1 To UBound(Qrr, 1) Step 19
   For j = 2 To UBound(Qrr, 2) Step 9
      T1 = Qrr(i, j): T2 = Qrr(i, j + 1): TT = T1 & "|" & T2
      If T1 = "" Or T2 = "" Then GoTo j01
      Set Y(TT) = Range(Q(i, j - 1), Q(i + 18, j + 7))
      Y(TT & "|v") = Y(TT)
j01: Next
Next
Set A = Sha.[B1:J19]: Arr = A
T1 = Arr(1, 2): T2 = Arr(1, 3): TT = T1 & "|" & T2
If K = 1 Then A = Y(TT & "|v")
If K = 2 Then Set Q = Y(TT): Q = Arr
Set Y = Nothing: Set Q = Nothing: Set A = Nothing
Set Sha = Nothing: Set Shq = Nothing: Erase Qrr, Arr
End Sub
'================================
Sub ¸ü¦ÜAAªí()
K = 1: Call TEST
End Sub
'================================
Sub ¼g¤JQQªí()
K = 2: Call TEST
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 10# zz0660


§Ú¥Î§A8¼Óªºªþ¥ó¨º­ÓÀÉ®×´ú¸Õ¡A¤@¯ë¼Ò²Õ©M¤u§@ªí³£¨S°ÝÃD¡A½Ð¦A½T»{¡AÁÂÁÂ

TOP

¦^´_ 9# samwang

½Ð°Ý±z§âµ{¦¡½X©ñ¦b­þ¸Ì?



¬OAA¤u§@ªí¡AÁÙ¬O¥t¥~¶}¤@­Ó¼Ò²Õ©O?

TOP

¦^´_ 8# zz0660

§Ú´ú¸Õ¨S°ÝÃD¦pªþ¥ó¡A¥i§_¦AÁ¿¸Ô²Ó¤@ÂI¡AÁÂÁÂ

11.PNG (37.65 KB)

11.PNG

TOP

¦^´_ 7# samwang


    ·PÁ±z¨ó§U³B²z°ÝÃD¡A¥Ø«e¨Ï¥Î¸Óµ{¦¡½X¡A¨S¦³¥ô¦ó¤ÏÀ³¡A¦b¦¹´£¨ÑÀɮסC
QQA.rar (25.51 KB)

³Â·Ð±z¤F¡AÁÂÁÂ!

TOP

¥»©«³Ì«á¥Ñ samwang ©ó 2021-7-29 07:28 ½s¿è

¦^´_ 6# zz0660

½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test_T1()
Dim Arr, T, xR, T1, i&, j&, xC%
With Sheets("AA")
    T = .Range("c1"): xR = .Range("d1")
    Ar = .Range("b3:i19")
End With
With Sheets("QQ")
    If xR = "T1" Then
        Arr = .Range("a1:h" & .[b65536].End(3).Row): xC = 0 'T1
    ElseIf xR = "T2" Then
        Arr = .Range("j1:q" & .[k65536].End(3).Row): xC = 9 'T2
    ElseIf xR = "T3" Then
        Arr = .Range("s1:z" & .[t65536].End(3).Row): xC = 18 'T3
    End If
     For i = 1 To UBound(Arr) Step 19
         T1 = Arr(i, 2): If T1 = "" Then GoTo 99
         If T1 = T Then
             .Cells(i, 1).Offset(1, xC).Resize(17, 8).Value = Ar
             Exit Sub
         End If
99:   Next
End With
End Sub

TOP

¦^´_ 5# samwang


    ±z¦n¡A²{¦b·Q§â«ö¶s´«¦¨¤U©Ô¦¡¿ï³æªº¤è¦¡¡A·íd1Äæ¦ìŪ¨ú¨ì¿ï³æ¤º®e¬°T1¡A´N·|Åã¥ÜQQªí³æªº¬Û¹ïÀ³¦ì¸m¡C

TOP

¦^´_ 4# zz0660

¤£¦n·N«ä¡A¥i§_½Ð¸ÑÄÀ¸Ô²Ó¤@ÂI¡AÁÂÁÂ

TOP

¦^´_ 2# samwang

Sub test_T1()
Dim Arr, T,U ,T1, i&, j&
T = Sheets("AA").Range("c1")
U = Sheets("AA").Range("d1")
Ar = Sheets("AA").Range("b3:i19")
With Sheets("QQ")
     Arr = .Range("a1:h" & .[b65536].End(3).Row) 'T1   T1,T2,T3½Ð¦Û¦æ¿ï¾Ü§ó´«
    'Arr = .Range("j1:q" & .[k65536].End(3).Row) 'T2
     'Arr = .Range("s1:z" & .[t65536].End(3).Row) 'T3
     For i = 1 To UBound(Arr) Step 19
         T1 = Arr(i, 2): If T1 = "" Then GoTo 99
         If T1 = T Then
             .Cells(i, 1).Offset(1).Resize(16, 8).Value = Ar
             Exit Sub
         End If
99:   Next
End With
End Sub

±µ¤U¨Ó´N¤£ª¾¹D«ç»ò¥Î¡A¤£ª¾¹D¬O¤£¬O³o¼Ë§ï¡C

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD