Excel 輸出整理,初始值 + 間隔值 * 次數
[方案1] 比 [方案2] 效率好很多
With ShtXX
Mod_i = i Mod 10 '取得尾數
Sort_R1 = Stay + (All_Ball) * Mod_i
Sotr_C1 = (All_Ball - 1 + Stay) + (All_Ball) * Mod_i
'lLastCol
'[方案1]
lLastCol = 1 + 3 * (i \ 10) '初始值 + 間隔值 * 次數
'[方案2]
'lLastCol = .Cells(Sort_R1, Cells.Columns.Count).End(xlToLeft).Column
'橫式輸出
ShtXX.Range(.Cells(Sort_R1, lLastCol + 2), .Cells(Sotr_C1, lLastCol + 3)) = arrBall_Rng
'由大→小排序
Set XX_Rng = .Cells(Sort_R1, lLastCol + 2).CurrentRegion
XX_Rng.Cells(1, 2).Sort _
key1:=XX_Rng.Columns(2), Order1:=xlDescending, Header:=xlGuess
End With
With ShtXX
Mod_i = i Mod 10 '取得尾數
Sort_R1 = Stay + (All_Ball) * Mod_i
Sotr_C1 = (All_Ball - 1 + Stay) + (All_Ball) * Mod_i
'lLastCol
'[方案1]
lLastCol = 1 + 3 * (i \ 10) '初始值 + 間隔值 * 次數
'[方案2]
'lLastCol = .Cells(Sort_R1, Cells.Columns.Count).End(xlToLeft).Column
'橫式輸出
ShtXX.Range(.Cells(Sort_R1, lLastCol + 2), .Cells(Sotr_C1, lLastCol + 3)) = arrBall_Rng
'由大→小排序
Set XX_Rng = .Cells(Sort_R1, lLastCol + 2).CurrentRegion
XX_Rng.Cells(1, 2).Sort _
key1:=XX_Rng.Columns(2), Order1:=xlDescending, Header:=xlGuess
End With
留言
張貼留言