+ Reply to Thread
Results 1 to 7 of 7

Remove blank rows from list box

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    6

    Unhappy Remove blank rows from list box

    Trying to remove blank lines from listbox
    Trying to use this code for excel 2003
    but am getting run time error 438 on 4th line
    object does not support this property or method

    Please Login or Register  to view this content.
    Last edited by arlu1201; 08-29-2012 at 12:00 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Remove blank rows from list box

    Hello there,

    Have you tried replacing your existing listbox with an ActiveX control Listbox instead. It is easier to perform the action you are trying to execute.

    If you do that then your code would look like this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-29-2012
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Remove blank rows from list box

    does 2003 have acxtive X

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Remove blank rows from list box

    I believe so. Try creating it by using this line of code

    Please Login or Register  to view this content.
    This should add the listbox to the first worksheet in your workbook.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Remove blank rows from list box

    Delolding,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Registered User
    Join Date
    08-29-2012
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Remove blank rows from list box

    My version is without active x

  7. #7
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Remove blank rows from list box

    Hello there,

    I couldn't figure out how to add items to a non ActiveX control list box but I found a work around:

    Please Login or Register  to view this content.
    Basically the code filters column A to column L and filters only unique values. Where column A is the original data and column L will not be the unique values from column A. Then it sort the values in column L ascending so that the blank cell does on the bottom. Finally sets the listbox's listitems to column L from row 1 to the last row that contains a value.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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