+ Reply to Thread
Results 1 to 23 of 23

ListView Mod!

  1. #1
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    ListView Mod!

    Hi There
    I would appreciate if someone could take a look at my workbook and help me modify the code in the standard module so that it will pull the data from sheet into the ListBox.
    Curently the values are set in the VBA Code so listbox it doesn't display the data from sheet 1. I have tried to do it but was getting all kinds of diferent errors......

    Thank You for your help

    Dan
    Attached Files Attached Files
    Last edited by ciapul12; 01-22-2014 at 05:40 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: ListView Mod!

    This isn't hard, but your explanation has a few holes. What data from the sheet do you want load into the ListBox? If it's more than one column, what columns do you want displayed in the ListBox?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by 6StringJazzer View Post
    This isn't hard, but your explanation has a few holes. What data from the sheet do you want load into the ListBox? If it's more than one column, what columns do you want displayed in the ListBox?
    My Mistake :-(
    I would like to display the data from sheet 1 columns A,B,C,D rows 2-500 for each column it is easy to just display this data but I want to make sure that it still works as it is now so that I can load data from 1 listbox to another ect.
    Thank You
    Dan

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    Change the GetInfoFromSomewhere routine to:
    Please Login or Register  to view this content.
    and then adapt the code in the form as follows:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Thanks it works well in the same workbook but it doesn't work in my other workbook
    this is the error:
    User defined type not defined

    with this line of code:
    Please Login or Register  to view this content.
    This is a whole code:
    Please Login or Register  to view this content.
    Any idea why this has happened when I have changed the workbooks? and how to fix it?
    Thanks

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: ListView Mod!

    Add a reference to the Listview control in the 2nd workbook... (Menu: Tools/References)

  7. #7
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Thanks
    What is the reference name as I can't find it???

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    You need to add the listview into the controls toolbox I suspect

  9. #9
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Grate it works
    THANK YOU!!! :-)
    One more question....
    Previously I have used the standard listbox which was populated with data from sheet 1 but only if the WORD in column Y was "OPEN" THIS MEAN THAT THE REPORT IS STILL OPEN.

    Would it be possible to do with my new ListView??

    Here is the code:
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    You need to add the listview into the controls toolbox I suspect
    Hi Kyle123
    Would you be so kind and take a look at my code above please?

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    Like this, as an example in your sample workbook, change some of the Person Names to OPEN
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Kyle123; 01-24-2014 at 05:24 AM. Reason: fix typos

  12. #12
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    Like this, as an example in your sample workbook, change some of the Person Names to OPEN
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Hi Kyle123 :-)
    Thank you so much for replaying !
    I think it will work but curently I am getting this error: Invalid Property Value with this line of code: avar.SubItems(ii) = CompanyInfo(i)(ii)
    Any Idea what may be wrong.
    Thank Yoy again!
    Dan

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    Dunno, check the code you're actually using as I made an edit after the post.

    Here's a working example
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    Dunno, check the code you're actually using as I made an edit after the post.

    Here's a working example
    Forgot to mention that this was a test workbook and on the original workbook the OPEN is in column Y and I cannot change it due to layout.
    It does work with the sample book so it could be a question of layout of my workbook??? I'ts still Sheet 1 but has lot more columns with data..... 35 being more specific

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    AS per the comments in my code, you need to amend the column that you are checking for the word in. Without a more accurate mock-up I'm struggling to help any further really, just set break points in your code and inspect the locals to try and suss it out.

  16. #16
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    AS per the comments in my code, you need to amend the column that you are checking for the word in. Without a more accurate mock-up I'm struggling to help any further really, just set break points in your code and inspect the locals to try and suss it out.
    Ok Let me upload amy workbook then :-)

  17. #17
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    AS per the comments in my code, you need to amend the column that you are checking for the word in. Without a more accurate mock-up I'm struggling to help any further really, just set break points in your code and inspect the locals to try and suss it out.

    It's not best looking workbook but this is exacty how I have it in my orginal book the one I was getting an error.
    So what I would like to see is 4 columns displayed when text in column Y=OPEN
    ColumnA
    ColumnB
    ColumnN
    ColumnR
    Column Y doesn't need display status but if it can be done then it's even better....

    Thanks You I really mean it!
    Attached Files Attached Files

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    Off the bat you don't have enough headers, you've only got 4, you need one for each column. Your formatting is also a bit of a mess and so needs allowing for, the below isn't as dynamic as I'd like, but works:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  19. #19
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    Just re-read that you only want certain columns, try this:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Quote Originally Posted by Kyle123 View Post
    Just re-read that you only want certain columns, try this:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Kyle you're are amazing!!
    Everything works as it should apart from I cannot copy selected row into second listbox...
    and also how do I limit the amount of column displayed in listview?
    Thanks you so much for your help.

  21. #21
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    That code does limit the number of columns? There should only be 5?

    The listbox works fine for me, what issue are you having?

  22. #22
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: ListView Mod!

    Kyle I can't thank you enugh!!
    It's all working now
    Tahnk you for your help :-)

  23. #23
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ListView Mod!

    No probs

+ 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. [SOLVED] ListView syntax help.
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 05:13 PM
  2. Listview
    By Sergio Sora in forum Non English Excel
    Replies: 0
    Last Post: 06-26-2012, 07:52 AM
  3. 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
  4. Can not add/see ListView (MSCOMCTL.OCX ...?)
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2012, 01:04 AM
  5. Listview Interactive
    By njesus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2010, 04:29 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