Solved

TreeView Component In Excel

Posted on 2007-11-21
2
709 Views
Last Modified: 2013-12-25
Trying to use treeview component within excel.   I was able to get this work for 1 set of Parent Child relationships.  
I need to build another treeview component to work off the first treeview component where when the user checks off Parent or child in the first tree the 2nd tree automatically finds the Children in the 2nd Tree.
ExAMPLE:

Tree 1                                       Tree2
X Parent1                                     X Child1
      XCHild1                                        SubChild2
      Child2                                          SubChild3
      Child3                                       Child2
0
Comment
Question by:Good5388
2 Comments
 
LVL 9

Expert Comment

by:dmang
ID: 20327995
Hi there

Why not build int all in the same treeview?

regards
dmang
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 20334373
Hi Good5388,

You can do a search in the other treeview (treeview2) and select the item. for the treeview1 add this code

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Dim myNode As Node
For Each myNode In TreeView2.Nodes
 If Node.Text = myNode.Text Then
   myNode.Selected = True
   Exit For
 End If
Next
End Sub

In order to see the selection you have to unhide the selection

TreeView1.HideSelection = False
TreeView2.HideSelection = False
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 - SQL Timeout 9 25
Excl VBA Find last column in disjointed range selection 18 23
vba autofilter in row 4 6 11
Sum 2 rows formula - months 6 15
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question