VBA~請修正為如需求的程式碼。
需求︰
只產生=R欄最末數值(=$S$6)之T欄位~無法產生應有的效果檔。
請問︰下列程式碼應該如何修正? 謝謝!
Fors = 1 To 49 Sheets(s).Select With Sheets(s) q = 7 t = 20 e = mthcount + 7 .Range("r5") = s For Each a In .Range("B7", "H" & e) If a = .[R5] Then .Cells(q, 17) = a.Offset(-1, 0).Value .Cells(q, 18) = Cells(a.Row,1).Value .Cells(q, 19) = a.Offset(1, 0).Value q = q + 1 End If Next a Qdown = .[S6].End(xlDown).Row .Cells(4, t) = .Cells(Qdown, 17) .Cells(5, t) = .Cells(Qdown, 18) .Cells(6, t) = .Cells(Qdown, 19) .Cells(3, t) = mthcount -.Cells(Qdown, 18) .Cells(1, t) ="=IF(Count(offset(A7,,COLUMN()-1,243)),"""",1)"'T1~Tn公式 .Cells(1, t + 1) = "=1" .Cells(1, t).Interior.ColorIndex = 6 'T1標示Color t = t + 1 If t > 20 Then
︰
︰
︰
︰
Next s
筆誤修正︰
只產生=R欄最末數值(=$S$6)之T欄位
改為
只產生第5列=R欄最末數值之欄位
謝謝!
1 個解答
- 顯栓Lv 79 年前最佳解答
t = t + 1
If t > 20 Then
'---------------------10
If num = 10 Then
tc = 20
For tr = 1 To q – 1
'OR(($R$5=OFFSET($A$7,$R7,1,,7))*($R$5=OFFSET($A$7,T$5,1,,7)))
For I = 1 To 7
If .[R5] = .[A7].Offset(.Cells(tr + 6, 18), I) Then
If .[R5] = .[A7].Offset(.Cells(5, tc), I) Then
.Cells(tr + 6, tc) = .Cells(tr + 6, 18) + .Cells(3, tc)
End If
Exit For
End If
Next
Next
End If
: :