+ Reply to Thread
Results 1 to 11 of 11

ListRows.Add crashes Excel and restarts

  1. #1
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    ListRows.Add crashes Excel and restarts

    Hi,

    This is about excel crashing with .ListRows.Add line for a table. I have searched various forums for this issue. But haven't received a solution. In case anyone has a solution please help.

    The problem is the code works at times and crashes at some other times. Sometimes, I add one record and it works. And when I add the second record it crashes.

    I am using Office 365.

    There are two excel files.

    File 1: This is the macro enabled file with user forms
    File 2: This has four sheets: Customer Master Data, Services Master Data, Service Profile & Service Log.

    The problem is with the table in the Services Master Sheet of File 2.

    The relevant code having the problem is as follows. I have marked the code line where excel crashes as "EXCEL CRASHES AT THIS LINE"


    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: ListRows.Add crashes Excel and restarts

    Do you populate the table "ServMastTbl" data to a Listbox or Combobox in the userform? and use Rowsource property to do that?

  3. #3
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: ListRows.Add crashes Excel and restarts

    Yes. I populate the ServMastTbl data to a Listbox and use the Rowsourse property. Am I not supposed to do that?

  4. #4
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: ListRows.Add crashes Excel and restarts

    Well, Rowsorce isn't reliable, please read this article:
    http://www.snb-vba.eu/VBA_Fill_combobox_listbox_en.html

    "If you use 'rowsource' you make a direct link to a certain range in a worksheet.
    Combined with the combobox it can cause Excel to blackout, because any change in the combobox will be transferred directly to the 'source'.
    Excel has proven not to be able to do this correctly.
    Besides: the changing of the source at every change in the combobox slows down your code.
    You should reduce the reading/writing from/to a workbook in your code as much as possible."

  5. #5
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: ListRows.Add crashes Excel and restarts

    Thank you for your help. I will now figure out how to use Array to populate the listboxes in my application.

    rgds
    hemant

  6. #6
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: ListRows.Add crashes Excel and restarts

    You're welcome, glad to help, & thanks for the feedback.

  7. #7
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: ListRows.Add crashes Excel and restarts

    Hi Akuini,

    A question: Will it be all right to use a 2-D array to store thousands of rows of a table ?

    e.g. a table having 10-20 thousand rows and 30-40 columns

    Is there a limit or recommended size in using 2-D arrays to store table values? Or any dependencies like Excel version or Computer Memory?

    rgds
    hemant

  8. #8
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: ListRows.Add crashes Excel and restarts

    Another question. Please refer to the beginning of my code above.

    Is it okay to have so many Public variables is not an issue? These are used in other 3-4 forms too.

  9. #9
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: ListRows.Add crashes Excel and restarts

    Sorry, your question is beyond my knowledge and because this is different from your initial problem, you may need to start a new thread.

  10. #10
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: ListRows.Add crashes Excel and restarts

    No Problem. Thanks for your help. I have used Array to populate list box and now Excel does not crash.

  11. #11
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: ListRows.Add crashes Excel and restarts

    Ok, glad to hear it works.

+ 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. [SOLVED] Listrows add crashes Excel 2013
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-02-2020, 06:54 AM
  2. Macro crashes intermittently - believe on the listrows.add function
    By erblues in forum Excel Programming / VBA / Macros
    Replies: 37
    Last Post: 09-06-2018, 03:50 AM
  3. [SOLVED] Dynamic based on criterias, Delete Excel Table with Selection.ListObject.ListRows(x).Delet
    By radian89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2017, 10:51 PM
  4. Replies: 3
    Last Post: 10-28-2015, 12:25 PM
  5. [SOLVED] ActiveX Combobox listrows property being ignored
    By Leon V (AW) in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2014, 01:19 PM
  6. Replies: 5
    Last Post: 05-20-2014, 09:35 PM
  7. ComboBox ListRows Property
    By garmstro in forum Excel General
    Replies: 4
    Last Post: 03-01-2010, 11:17 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