+ Reply to Thread
Results 1 to 2 of 2

Clearing a listbox

  1. #1
    Registered User
    Join Date
    01-09-2021
    Location
    NANYUKI, KENYA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    17

    Clearing a listbox

    Hello

    Regards to all. Still a fresher but seeking some enlightened help and direction on how to clear a Bound List box in an excel user form. Am trying to creat a Stock and Sales Management System using in Excel using VBA code. Initially I had no idea how challenging this task would turn out to be. Currently about 65 percent of the work is done but still a lot to get done. I have attached my workbook named STOCK SYSTEM 3.xlms. Focus on Userform7. This is a Sales Search Form through which the user can search for individual item receipts, view individual cashier sales based on a start and end date, individual item sales and specific transaction sales whether Retail or Wholesale. The form partially works but my challenge is clearing or refreshing the battery of textboxes and the List box (LISTBOX1) after a search is conducted that is on Command button 6 (CLEAR DATA RESULTS). Whenever I click at this button it seems to work the first time but after that I am getting infuriating errors on Listbbox1.Clear line of code. Can anyone please guide inputting a smoothing working coding that will fulfill this task

    Will appreciate any available help provided.

    Regards
    DEBLACKJACKAL
    Attached Files Attached Files

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

    Re: Clearing a listbox

    It could be the problem:
    Please Login or Register  to view this content.
    Please check this:
    http://www.snb-vba.eu/VBA_Fill_combobox_listbox_en.html
    In the article:
    "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. "

    so replace with this:
    Please Login or Register  to view this content.

+ 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. Clearing an Excel table w/o clearing formulas
    By gjstacey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2020, 03:59 PM
  2. Clearing contents of multiple TextBox and ListBox on UserForm
    By Xceller in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-13-2020, 03:10 PM
  3. [SOLVED] Listbox selection not clearing...
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2019, 03:49 AM
  4. Clearing of listbox causing excel to crash
    By vlad67 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-14-2017, 04:04 PM
  5. [SOLVED] Userform combobox populates ListBox errors on clearing control
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2017, 04:42 PM
  6. [SOLVED] if anything in listbox select first item, if listbox empty do nothing (listbox in userform
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2015, 12:49 PM
  7. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM

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