+ Reply to Thread
Results 1 to 8 of 8

User Form Listbox.Rowsource Problem and Solution

Hybrid View

  1. #1
    Registered User
    Join Date
    04-04-2020
    Location
    Bradenton, FL, USA
    MS-Off Ver
    Office 365 MSO 32-Bit
    Posts
    1

    Re: User Form Listbox.Rowsource Problem and Solution

    I had this Excel crash problem as well. It seems the crash was caused by having the Listbox.RowSource set to the table or range while the code was doing the update work to that table or range.

    The crash stopped when I set the Listbox.RowSource to "", updated the data, and then reconnected the Listbox.RowSource to the range. I am actually setting the RowSource = to a ListObject.

  2. #2
    Registered User
    Join Date
    01-10-2022
    Location
    Guatemala
    MS-Off Ver
    365
    Posts
    1

    Re: User Form Listbox.Rowsource Problem and Solution

    Edward, thank you so much!
    I was having this problem and I'm not too familiar with VBA and was desperate haha. I used your solution in the "add" button code and works perfectly. It doesn't crash anymore.

  3. #3
    Registered User
    Join Date
    01-31-2024
    Location
    Home
    MS-Off Ver
    Office 365
    Posts
    14

    Re: User Form Listbox.Rowsource Problem and Solution

    Quote Originally Posted by EdwardMartin View Post
    I had this Excel crash problem as well. It seems the crash was caused by having the Listbox.RowSource set to the table or range while the code was doing the update work to that table or range.

    The crash stopped when I set the Listbox.RowSource to "", updated the data, and then reconnected the Listbox.RowSource to the range. I am actually setting the RowSource = to a ListObject.
    Hello, I am sorry for necroing the thread - how exactly does one do that? I am having the exact same issue, using listbox Rowsource and having runtime error.

    Private Sub AddDataToListBox()
    'grab the range
        Dim rg As Range
        Set rg = GetRange()
        
    'link the range to the list box
        With ListBoxArtikel
        .RowSource = rg.Address(external:=True)
        .ColumnCount = rg.Columns.Count
        .ColumnWidths = "30;100;80;310;0;0;70;70;70;70;70;70;70;70;70;0;0;0;0;0;0;0"
        .ColumnHeads = True
        .ListIndex = 0
        End With
        
    End Sub
    So I should have "" instead of "rg.Address(external:=True)", and then somehow update it afterwards? How?

    Thank you for any help.
    Attached Files Attached Files

+ 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. User Form ListBox - Find Records (ListBox Populating Issue)
    By LONeillSSC in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-20-2015, 12:06 PM
  2. Listbox Update on user form
    By Irish_Griffin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-15-2009, 02:41 PM
  3. Functional Listbox in User Form
    By warby23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2009, 05:17 AM
  4. populating a listbox on a user form?
    By lrhodes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2006, 07:05 PM
  5. RowSource for User Form
    By Klatuu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-23-2006, 06:30 PM
  6. Listbox RowSource problem
    By Casey in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-22-2006, 05:10 PM
  7. [SOLVED] [SOLVED] Listbox.RowSource problem
    By Tim Coddington in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-08-2005, 08:06 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