+ Reply to Thread
Results 1 to 5 of 5

Excel runtime error trying to add new rows to a table

  1. #1
    Registered User
    Join Date
    03-05-2024
    Location
    Vermont
    MS-Off Ver
    Office365
    Posts
    3

    Excel runtime error trying to add new rows to a table

    Excel novice here again - old dog new tricks. I've been working on some data entry userforms in my workbook, and an encountering a runtime error whenever I try to add new blank rows to an existing named table. The runtime error code is -2147417848 (80010108) "Method 'Add' of object 'ListRows' failed. The table is not protected, the cells are not protected, the table only has 16 existing rows. I've tried reconstructing the code from scratch and splitting the code up to separate subroutines to first add the empty rows, then add data to the rows. Can anyone decipher why this happens? I really need to solve this so I can complete the rest of my work. Here's the code:
    Please Login or Register  to view this content.
    Administrator's note: Please take the time to review our rules. There aren't many, and they are all important. Our guidelines recommend code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 03-13-2024 at 06:55 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: Excel runtime error trying to add new rows to a table

    Can you upload the spreadsheet? If I create a table and do ListRow.Add the way you did I don't get any errors.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,056

    Re: Excel runtime error trying to add new rows to a table

    Quote Originally Posted by jthomp6395 View Post
    The table is not protected, the cells are not protected
    Is the worksheet protected though? If so, you can't add rows to the table.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Registered User
    Join Date
    03-05-2024
    Location
    Vermont
    MS-Off Ver
    Office365
    Posts
    3

    Re: Excel runtime error trying to add new rows to a table

    The worksheet is not protected either. I checked through all that. I suspect that a different subroutine is causing the conflict, but I don't know which or why.

    I've attached the file - it's a program to make data entry for energy code evaluation for buildings easier. It has three userforms - frmWall, frmOpen, and frmTB. Module 1 code relates mostly to frmWall, module 2 code to frmOpen, and module 3 code to frmTB.

    frmTB is the one I've found causing the runtime error, but I think frmOpen is experiencing the same.

    I know my code will be clunky and have faults - I'm an architect (not software) and this is my first time trying to write extensive code. I was starting to go through it to fix known mistakes when it started crashing my Excel.

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: Excel runtime error trying to add new rows to a table

    Investigate whether the cause of the problems is the use of the RowSource property for the ListBox control. Instead of:
    Please Login or Register  to view this content.
    you can use
    Please Login or Register  to view this content.
    You lose, admittedly, the ability to use table column headers, but the problem can be easily solved by adding labels over the LisBox control.
    If I hit it, it's a known bug in Excel.
    The problem can be circumvented by still using RowSource, but before expanding the table, you must first destroy the link to the table
    Please Login or Register  to view this content.
    then add a row and rebuild the link, but already to the new range.

    Artik

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Runtime Error when inserting new row into table.
    By jekeith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2018, 02:32 PM
  2. Pivot Table Runtime error 1004
    By Code Flunkie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2017, 05:39 PM
  3. [SOLVED] Runtime error '13' type mismatch when posting userform entries to excel table
    By Deventre in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2016, 11:32 AM
  4. HELP! Runtime error 13 Sending two non-contiguous rows as a table
    By g1987 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-15-2012, 05:49 PM
  5. Runtime error 438 in Pivot table macro
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-10-2012, 11:12 AM
  6. Excel 2007 pivot table/macro/Runtime error 1004
    By abalserv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2010, 06:36 AM
  7. [SOLVED] pivot table Commandtext causes runtime error 1004 in excel 2000
    By Therezee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2006, 11:45 PM

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