+ Reply to Thread
Results 1 to 2 of 2

"method add of object listrows failed"

Hybrid View

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    Dayton, OH
    MS-Off Ver
    Excel 2010
    Posts
    1

    "method add of object listrows failed"

    I have an VBA application that I've built within an .xlsm file. The following code is giving me an ongoing headache in that after it's been invoke a couple of time (or a dozen times--there's no predicting), I get an error message: "method add of object listrows failed". If I debug, the problem line is the ListRows.Add line. If I continue executing the code, I get a 1004 error message related to the same line and then Excel freezes and crashes and then restarts. I'm at a loss as to what the problem could be. I have code to flush the clipboard and the FreeIt function you see below unprotects the sheet where the ListObject resides. Also, I sometimes get the error when invoking another sub the deletes lines from the ListObject. And when I've tried to workaround the Add method by simply resizing the ListObject.Range by a single row, sooner or later I get the same error message, only it's "method resize of object range failed".


    I've been up and down the forums out there and can't find a satisfactory answer.

    Private Sub InsertRow()
        Dim RowNr As Integer
        Dim b As Boolean
            
        b = FreeIt()
     
        If line <> -1 Then
            RowNr = line
        Else
            RowNr = Target.Rows.Count
        End If
    
        ClearClipboard
        
        ThisWorkbook.Worksheets("Configurator").ListObjects("Products").ListRows.Add
    
        RevertIt (b)
    End Sub

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: "method add of object listrows failed"

    Also posted here.
    Good luck.

+ 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