+ Reply to Thread
Results 1 to 8 of 8

error filter in listview

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    error filter in listview

    Hi.

    i have error, when use loop (filter criteria) in ListView.

    look step-by-step in my file tab("Image_Error)
    Attached Files Attached Files
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: error filter in listview

    Not sure what is going on with your code, you are selecting A4 and then xldown, but there is nothing below A4. What is supposed to happen?
    Last edited by davesexcel; 12-21-2013 at 06:00 AM.

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: error filter in listview

    Hi
    I am quite surprised with your quality of code, when do you ever select a range in a userform?
    I got watching a tutorial

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: error filter in listview

    Hi, marreco,

    I doubt it´s good practise to fill a ComboBox with any available value from a list and then afterwards work with a couple of loops to make the items unique. I´d expected to work with CountIf here and only add items if they appear for the first time.

    Please Login or Register  to view this content.
    Whenever you make any choice in the first ComboBox the number of filled columns reduces from 9 to 5 so you should try and only convert that in the code:
    Please Login or Register  to view this content.
    I find it really difficult to have no information about what you want to do but to have a look at a workbook with comments in a foreign language, controls in a foreign language and not get the idea of what you are up to as the code itself interestingly brings up questions: why is there more than one entry if I choose 1 in the forst combobox? There should only be one name listed, not three - how does that fit in?

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: error filter in listview

    Hi, holger

    What a wonderful solution!

    Thank you very much!

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: error filter in listview

    Hi there,

    Thank you for the private message you sent me.

    The problem lies in the highlighted line in the following routine:

    Please Login or Register  to view this content.

    When the form is intitialised the number of data items the ListView contains is indeed equal to the number of Column Headers (i.e. nine), but when the above routine is executed the ListView contains only five items - this is the reason for the "Index out of bounds" error message.

    To correct this error you should replace the above highlighted statement with the following:

    Please Login or Register  to view this content.

    Take a look at the attached workbook and see if it does what you want. I've restructured a lot of your code so that the UserForm is now much more loosely coupled to worksheets than it was before. In general a UserForm should "know" as little as possible about the worksheets/workbook with which it is being used - reducing the coupling to the absolute minimum greatly increases the possibility of being able to use the UserForm in other applications.

    Hope the above helps - please let me know how you get on with it.

    Regards,

    Greg M
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: error filter in listview

    Hi Greg M

    Very good, i like it!!

    thank you very much!!!!!!!!!!!!!!!

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: error filter in listview

    Hi again,

    Many thanks for your very prompt feedback - I'm very pleased that I was able to help.

    Best regards,

    Greg M

+ 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. ClassFactory cannot supply requested class - ListView error on different machine
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2013, 07:58 PM
  2. Filter Listview based on TextBox Value
    By ioncila in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2012, 02:33 PM
  3. Listview
    By Sergio Sora in forum Non English Excel
    Replies: 0
    Last Post: 06-26-2012, 07:52 AM
  4. Listview checked row delete line in Listview and in worksheet data
    By madforit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2012, 01:00 PM
  5. Erro in Listview
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2012, 06:11 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