Results 1 to 4 of 4

[SOVLED] Error 1004 "Application Defined or Object Defined Error"

Threaded View

  1. #1
    Registered User
    Join Date
    05-14-2015
    Location
    Atlanta GA
    MS-Off Ver
    2007
    Posts
    16

    [SOVLED] Error 1004 "Application Defined or Object Defined Error"

    Hi, I'm new to writing macros in Excel and I'm trying to write on that iterates through the rows of an excel file until it matches a string, and delete all the rows before the string. Below is my code:

    Sub DeleteRows()
    LR = Cells(Rows.Count, "A").End(xlUp).Row
    Dim i As Integer
    
    i = 1
    Do While i < LR
        If StrComp(CStr(Worksheets("Sheet1").Range(i).Value), "Items in search results") = 0 Then
            Rows(1 & ":" & i).EntireRow.Delete
        Else
            i = i + 1
        End If
            i = LR
    Loop
        
    End Sub
    However, when I run the macro on my test spreadsheet, I get an error on the If statement saying there is an 'object defined error'. What does this mean? Thanks!
    Last edited by gautum123; 05-15-2015 at 09:56 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. getting error 1004 "Application defined or object defined error
    By The Fly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2014, 09:39 AM
  2. [SOLVED] Run time error:1004 "Application defined or Object defined error"
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-07-2014, 09:47 AM
  3. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  4. Error When Implementing Code: "1004 - Application-defined or object-defined error"
    By blueblazingdemon in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-10-2013, 11:21 AM
  5. Replies: 1
    Last Post: 05-06-2013, 06:07 AM

Tags for this Thread

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