求大神帮忙改一下EXCEL的VBA

图里的标示是从上至下,能不能改成人从下至上,就是3标在B9,4标在B8,这样反过来Sub 连续偶()Dim R As Integer, i As Integer, bz As Integer, num As Integer R = ActiveSheet.Range("A65536").End(xlUp).Row For i = 2 To R If Cells(i, 1) Mod 2 = 0 Then num = num + 1 Else num = 0 If num >= 3 Then Cells(i, 2) = Str(num) Next iEnd Sub

Sub 连续偶()
Dim i As Integer, num As Integer
For i = ActiveSheet.Range("A65536").End(xlUp).Row To 2 step -1
If Cells(i, 1) Mod 2 = 0 Then num = num + 1 Else num = 0
If num >= 3 Then Cells(i, 2) = Str(num)
Next i
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-07-09
Sub 连续偶()
    Dim R As Integer, i As Integer, bz As Integer, num As Integer
    R = ActiveSheet.Range("A65536").End(xlUp).Row
    For i = 2 To R
        If Cells(i, 1) Mod 2 = 0 Then num = num + 1 Else num = 0
        If num >= 3 Then
            k = [b1].End(xlDown).Row
            If k > 9 Then k = 9 Else k = [b1].End(xlDown).Row - 1
            Cells(k, 2) = Str(num)
        End If
    Next i
End Sub

相似回答