• Label captured when Macro run

    Author
    Topic
    #459695

    When I run the following macro, it captures the column label in Row 2 even though it is supposed to Step to 3.
    Any ideas why or what I can do to fix it?

    Sub LimitData
    Dim k As Long, l As Long

    k = Range(“I3000”).End(xlUp).Row

    For l = k To 3 Step -1
    If IsEmpty(Range(“M” & l)) Then
    Range(“M” & l).Value =0
    End If
    Next l
    End Sub

    Viewing 1 reply thread
    Author
    Replies
    • #1159795

      What exactly do you mean by “it captures the column label in Row 2”?

    • #1160027

      I finally figured it out. That if a column has no data in it the code will keep stepping -1
      I need to add
      If l < 3, then l =3

      code …
      End If
      Is there a better way to code it?

      • #1160038

        That shouldn’t be necessary; the original code should stop at row 3.

    Viewing 1 reply thread
    Reply To: Label captured when Macro run

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: