參考附件 : [attach]34188[/attach]
Sheets("Sheet1")的C2:AY21改成目前的格式~ 請問:下列紅色字顏的程式碼要如何修正?
我試改許久總是跳差1列
'=================================列137
.Range("c2:ay21").ClearContents
Crr = .Range("c2:ay9"): Arr = .Range("c37:ay" & R): n = 0
cR = Array("", 1, 2, 3, 6, 7, 8) '列140
For ci = 1 To UBound(cR) + 2: For cj = 1 To UBound(Crr, 2)
For ai = ci To UBound(Arr) Step 17
If Arr(ai, cj) = "" Then GoTo 97
Crr(ci, cj) = Crr(ci, cj) + Arr(ai, cj)
97: Next ai: n = 0
Next cj: Next ci
.[c2].Resize(UBound(Crr), UBound(Crr, 2)) = Crr
Crr = .Range("c13:ay20"): cR = Array("", 1, 2, 3, 6, 7, 8) '列149
For ci = 1 To UBound(cR) + 2: For cj = 1 To UBound(Crr, 2)
For ai = ci To UBound(Arr) Step 17
If Arr(ai, cj) = "" Then GoTo 98
n = n + 1: Crr(ci, cj) = n
98: Next ai: n = 0
Next cj: Next ci
.[c13].Resize(UBound(Crr), UBound(Crr, 2)) = Crr
Dim ci%-->Dim ci '列2
CR = Array("",1, 2, 3, 6, 7, 8)-->CR = Array(1, 2, 3, 6, 7, 8) '列140 '列149
For ci = 1 To UBound(cR) + 2 -->For Each ci In CR '列140 '列149作者: ziv976688 時間: 2021-10-11 08:54
Crr = .Range("c2:ay9"): Arr = .Range("c37:ay" & R): n = 0
'cR = Array("", 1, 2, 3, 6, 7, 8)
CR = Array(1, 2, 3, 6, 7, 8)
For Each ci In CR: For cj = 1 To UBound(Crr, 2)
For aii = ci To UBound(Arr) Step 17
If ci < 6 Then ai = aii Else ai = aii + 1
If Arr(ai, cj) = "" Then GoTo 97
Crr(ci, cj) = Crr(ci, cj) + Arr(ai, cj)
97: Next aii: n = 0
Next cj: Next ci
下段也需要改作者: ziv976688 時間: 2021-10-12 23:54