Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Nov 2003
    Location
    Tampa, Florida, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    What exactly do you mean by "it captures the column label in Row 2"?

  3. #3
    Star Lounger
    Join Date
    Nov 2003
    Location
    Tampa, Florida, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    That shouldn't be necessary; the original code should stop at row 3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •