+ Reply to Thread
Results 1 to 9 of 9

Treeview Control

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Treeview Control

    I've just come across the treeview control and it seems perfect for what I want but I have no idea how to write any code for it.

    On the attached example, I have created a userform and added the control to the form. What I want is for the parent node (I think that is the right terminology!) to be each unique 'market' name from column F of the worksheet 'Selections' then within each Market node I want there to be a node with the selections (Column G of the Selections worksheet) for that market and the Live Price from column on this same node.

    So, basically the first parent node should be '90 Mins' with three children 'Bournemouth 8/13', 'Draw 27/100', 'Chesterfield 9/5'.

    i.e.

    - 90 Mins
    Bournemouth 8/13
    Draw 27/100
    Chesterfield 9/5
    + Correct Score
    + Under/Over 1.5 Goals
    + Under/Over 2.5 Goals

    Does that make sense???
    Attached Files Attached Files

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Treeview Control

    You must have uploaded the wrong file, because you can't have code in xlsx.
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Treeview Control

    Add treeview and command button to userform.

    Please Login or Register  to view this content.
    display userform and press button to populate treeview
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Treeview Control

    Thanks for your reply Andy, it's exactly as I was looking for. After playing around with it though I've come up with a couple of additions I'd like to try and add if possible.

    1) Can we add a parent to the current parent level which groups markets by type? If you look at my latest attached version; I have added a column to the Selections worksheet that gives each market a 'market type'. So for example the tree would then look something like this....

    - Results
    + 90 Minutes
    - Scores
    + Correct Scores
    - Goals
    - Under/Over 1.5 Goals
    Under 1.5 Goals
    Over 1.5 Goals
    + Under/Over 2.5 Goals

    2) In column Q there is now a percentage figure against the last selection each market. Could we add this to the market node name. i.e "Correct Score (138.00%)"?

    3) Can we make the tree only show markets if column A has the word "Football" against each of the selections in the market?

    4) Simarly, can we also only show selection in markets if the value in column P for that selection is less than 200?

    5) Finally, a bit of an aesthetic one really but can we make the indentation of the price against each selection be the same so they all look in line with one another? Basically, so the selection names and the prices look as though they are in two seperate columns on a table. For example, the correct scores currently look like this...

    Bournemouth 1-0 13/2
    ....
    Bournemouth 9-1 500/1
    Draw 0-0 9/1
    etc.

    Could we have it so that the 13/2, 500/1 and 9/1 are all in a single line as if they are in a seperate column to the selection names.Would just look a lot neater that's all.

    Any help would be much appreciated!

    Many Thanks,
    Adam.
    Attached Files Attached Files
    Last edited by adam2308; 08-15-2012 at 10:53 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Treeview Control

    You have still uploaded a workbook with no code
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Treeview Control

    Sorry, this should be better now.
    Attached Files Attached Files

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Treeview Control

    Where is your attempt at "additions I'd like to try and add". All I see is the original code.

  8. #8
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Treeview Control

    Hi Andy. Sorry, there is no attempt at adding the extra code needed on the attached. I have no idea where to start. I've simply added a new workbook with the form with treeview and added the additional bits of info on the worksheet, i.e. market types etc.

    I've changed
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    which helps to keep to the selections and prices better aligned. So,if point 5 is a difficult or impossible task then I can live with the change I have mad here.

    I would really appreciate any help and hopefully learn some new VBA.

    Cheers,
    Adam.

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Treeview Control

    Please Login or Register  to view this content.
    Alignment is difficult due to proportional font spacing

+ 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