+ Reply to Thread
Results 1 to 5 of 5

Listbox Rowsource bug

  1. #1
    Registered User
    Join Date
    09-28-2019
    Location
    Cotonou
    MS-Off Ver
    2016
    Posts
    2

    Listbox Rowsource bug

    Hello friends,
    I'm having challenge in my VBA code especially In Rowsource property.
    here is my code:
    Please Login or Register  to view this content.
    Please check this code for me because I notice the code works well the first time I click on the button. It bugs the second time on ListBoxProjets.RowSource.
    Please I need help

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Listbox Rowsource bug

    Never use RowSource to populate a ListBox or Combobox for that matter.

    Use the List-Property instead.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

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

    Re: Listbox Rowsource bug

    I agree with Bakerman2.

    This is from 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."

  4. #4
    Registered User
    Join Date
    09-28-2019
    Location
    Cotonou
    MS-Off Ver
    2016
    Posts
    2

    Re: Listbox Rowsource bug

    Thank you bakerman2 for your answer. The reason why I used RowSource Property is because I wanted to show the ColumnHeads. Your solution one does not show them. Do you know how to promote columnheads using your solution?

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

    Re: Listbox Rowsource bug

    One way to do it is to create another listbox, place it above the first listbox, populate the table header into it. You can play with many properties to change its appearance like background color, font size etc.

+ 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. listbox.rowsource
    By nyfmpha in forum Excel General
    Replies: 3
    Last Post: 11-13-2013, 12:07 AM
  2. [SOLVED] ListBox RowSource
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2013, 02:08 AM
  3. [SOLVED] Using OptionButtons to set a RowSource for a ListBox
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-04-2012, 03:44 PM
  4. specify worksheet in rowsource within a listbox
    By mania112 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2009, 10:17 AM
  5. filter listbox without rowsource
    By WCJanssen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2009, 08:32 AM
  6. Listbox - Rowsource
    By Paul W Smith in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2006, 05:30 PM
  7. range name as rowsource of listbox?
    By Stefi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 09:30 AM
  8. [SOLVED] RowSource in ListBox
    By Noah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2005, 10:10 AM

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