我怎样才能缩短这个?

时间:2017-09-08 13:12:30

标签: excel vba excel-vba

{{1}}

1 个答案:

答案 0 :(得分:3)

我会说它的大部分可以替换为:

Dim rw as Long

With Worksh.Range("D7")
     .AutoFill .Resize(120, 1), xlFillValues
End With
For rw = 127 To 9727 Step 120
    With Worksh.Cells(rw, 4)
        .Value = Worksh.Cells(rw - 1, 4).Value + 1
        .AutoFill .Resize(120, 1), xlFillValues
    End With
Next