Results 1 to 3 of 3

Can't get Rows to delete in macro

Threaded View

  1. #1
    Registered User
    Join Date
    01-24-2006
    Posts
    8

    Question Can't get Rows to delete in macro

    I have the following code which compiles and runs; however, it isn't deleting rows as it should be. Basically I want the macro to check each row of Column O and if that value is < 3301, delete the entire row and shift the cels up.

    The code is:

    For i = 2 To 2000
    If ActiveWorkbook.Worksheets(1).Cells(i, "O").Value <> "" Then
    If ActiveWorkbook.Worksheets(1).Cells(i, "O").Value < 3301 Then
    Rows(i).Delete Shift:=xlUp
    End If
    End If
    Next

    Just to make sure the loop is functioning properly I changed the delete line to

    With Row(i).Interior
    .ColorIndex = 6
    .Pattern = xlSolid
    End With

    This made every row with the value less than 3301 highlighted yellow so the loop functions fine. Just the deleteing part of it isn't...
    Last edited by Goobies; 02-02-2006 at 03:27 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1