+ Reply to Thread
Results 1 to 9 of 9

Listview add an index column at form initialization

  1. #1
    Registered User
    Join Date
    09-11-2015
    Location
    Hamilton, ON Canada
    MS-Off Ver
    2013
    Posts
    32

    Question Listview add an index column at form initialization

    Hello,


    I have a form I developed in Excel 2010 that has a Listview control and is populated from a sheet with 20 columns and 396 rows. I want to have and Index column that gets populated with row numbers at UserForm_Initialize(). The index column populates when I do a search using a combobox, textbox and a command button with the following code, but after working on it all day I cannot find a solution to load the index when the userform initializes. Also I add a column for the index during initialization (code below). Any help would be extremely appreciated.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    09-11-2015
    Location
    Hamilton, ON Canada
    MS-Off Ver
    2013
    Posts
    32

    Re: Listview add an index column at form initialization

    <bump> Still working on it, not making any progress.

    BigD

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listview add an index column at form initialization

    Hi BigD

    Welcome to the Forum!!!

    I've worked with ListView a bit and have done as I believe you're describing (capture a Row Reference). However, I don't understand this...the Index simply does not exist upon Initialization...
    I cannot find a solution to load the index when the userform initializes
    or this...
    'THIS WORKS BUT ONLY AFTER SEARCH CRITERIA IS RETURNED
    There is no Row Reference until the Search Criteria is returned, so, you have me a bit confused.

    Please attach a sample workbook the Structure of which is the same as your actual workbook.

    INCLUDE ANY CODE YOU'RE USING OR HAVE TRIED.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    09-11-2015
    Location
    Hamilton, ON Canada
    MS-Off Ver
    2013
    Posts
    32

    Re: Listview add an index column at form initialization

    Hi jaslake,

    Thank you for the reply. I was able to get Listview to load the Index values into the first column in the UserForm_Initialize about 1/2 an hour ago, however now I can't get the list to display the data in columns. Its either list is populated with data and no Index or Index and no data. The application is too large to post and contains company data. Here is were I'm at with the Initialization. It appears it will work, its just getting it set up right.

    BigD

    Please Login or Register  to view this content.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listview add an index column at form initialization

    Hi BigD

    You can zip the File and attach it if you wish.

    Alternately, you can Email the File so I can look at it...your choice.

  6. #6
    Registered User
    Join Date
    09-11-2015
    Location
    Hamilton, ON Canada
    MS-Off Ver
    2013
    Posts
    32

    Re: Listview add an index column at form initialization

    Hi jaslake,

    I made a test form to show what is happening and it is attached. It's close, but still needs something.

    BigD






    Post Edit: This File contains the search operation
    Attached Files Attached Files
    Last edited by BigDaddy01; 09-28-2015 at 07:48 AM. Reason: Updated File

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listview add an index column at form initialization

    Hi BigD

    In the attached I've replaced these lines of Code...
    Please Login or Register  to view this content.
    with this...
    Please Login or Register  to view this content.
    Let me know of issues.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-11-2015
    Location
    Hamilton, ON Canada
    MS-Off Ver
    2013
    Posts
    32

    Re: Listview add an index column at form initialization

    Hi jaslake,

    It works!!!

    That is just great, thank you so much for your time.

    One thing if anyone plans on using this make sure the SORT property of ListView is set to FALSE or else the first time the form is displayed it will not be in order. From what I've read it's because ListView sorts Alphanumerical and not Numerical on the first column.

    Thanks again to jaslake

    BigD

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listview add an index column at form initialization

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. VBA Chart initialization!!
    By meus in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-23-2015, 05:19 PM
  2. Multi Column Listview
    By Jovillanueva in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2014, 09:34 AM
  3. Display data in ListView upon specific text in column Y
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2014, 05:51 PM
  4. [SOLVED] I need to send a target.row variable to a User form Initialization sub. Is it Possible?
    By sdavison in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2013, 07:47 AM
  5. [SOLVED] Textbox enter, select item in ListView and pass the dice to Another Form
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2013, 06:16 AM
  6. 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
  7. Max number of item in a form (in a ListView)
    By Pierre in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2007, 07:13 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