+ Reply to Thread
Results 1 to 2 of 2

Run-time error '1004': No cells were found

  1. #1
    Registered User
    Join Date
    12-08-2011
    Location
    chicago
    MS-Off Ver
    Excel 2007
    Posts
    2

    Run-time error '1004': No cells were found

    Very strange. When I run this piece of the macro by itself, it works, not problems, no error. When I run this as part of a larger macro I get below error message at the step where all rows that contain TRUE in column J are to be deleted. Please help me!

    Run-time error '1004': No cells were found

    Sub delete_old_dates()
    Dim X As Long, MinDateColO As Date, DateChanged As Boolean, Arr As Variant
    MinDateColO = WorksheetFunction.Min(Worksheets("tis").Columns("O"))
    With Worksheets("ClearPar")
    Arr = Intersect(.UsedRange, .Columns("J"))
    For X = 1 To UBound(Arr)
    If Arr(X, 1) < MinDateColO Then
    Arr(X, 1) = True
    If Not DateChanged Then DateChanged = True
    End If
    Next
    If DateChanged Then
    Intersect(.UsedRange, .Columns("J")) = Arr

    ' the next line is where the error takes place,"Run-time error '1004': No cells were found". All the rows that contain TRUE in column "J" are supposed to be deleted.


    Columns("J").SpecialCells(xlConstants, xlLogical).EntireRow.delete
    End If

    End With

    End Sub

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Run-time error '1004': No cells were found

    Hello tirk82 and welcome to the Excel Forum.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

+ Reply to Thread

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