Sub test_T1()
Dim Arr, T, T1, i&, j&
T = Sheets("AA").Range("c1")
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作者: zz0660 時間: 2021-7-28 09:53
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
請測試看看,謝謝
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作者: zz0660 時間: 2021-7-29 22:55
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 寫入QQ表()
K = 2: Call TEST
End Sub