Can i get some help at my userform .
i try to add new Node child for the excite Node child .
as you can see at the attached form i have main parent witch is column" H " and the child is column "B".
i want to move column B and insert new column so column "B" will be the main child and column "C" add new child for the tree view .
Wish I could explain what i need
this the code i'm using
Sub treeview_load_data()
Dim cFilterRange As Excel.Range
Dim c As Range
Dim nParent As Node
Dim nChild As Node
Dim ws As Worksheet
On Error GoTo ErrHandler
Application.ScreenUpdating = False
tv.Nodes.Clear
tv.Top = 24
Set ws = Sheet1
With ws
'// Clear any set filters
'// AutoFilters
.AutoFilterMode = False
If .FilterMode Then .ShowAllData
'// Create the filtered range for Column A
Set cFilterRange = .Range("I1:I" & Sheet1.Range("I" & Rows.Count).End(xlUp).Row)
'// Apply a unique filter to Col A
cFilterRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
'// Now add only those visible rows - Using Col A here
For Each c In cFilterRange.SpecialCells(xlCellTypeVisible)
If c.Row <> 1 Then
tv.Nodes.Add , , c.Value, c.Value
End If
Next
.ShowAllData
Set cFilterRange = Nothing
Set cFilterRange = .Range("B1:B" & Sheet1.Range("I" & Rows.Count).End(xlUp).Row)
cFilterRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
For Each c In cFilterRange.SpecialCells(xlCellTypeVisible)
If c.Row <> 1 Then
Set nParent = tv.Nodes(c.Offset(0, 7).Value)
tv.Nodes.Add nParent, tvwChild, c.Value, c.Value
End If
Next
End With
ErrHandler:
tv.Top = 24
Application.ScreenUpdating = True
tv.Top = 24
End Sub
i try to add new Node child for the excite Node child .
as you can see at the attached form i have main parent witch is column" H " and the child is column "B".
i want to move column B and insert new column so column "B" will be the main child and column "C" add new child for the tree view .
Wish I could explain what i need
this the code i'm using
Sub treeview_load_data()
Dim cFilterRange As Excel.Range
Dim c As Range
Dim nParent As Node
Dim nChild As Node
Dim ws As Worksheet
On Error GoTo ErrHandler
Application.ScreenUpdating = False
tv.Nodes.Clear
tv.Top = 24
Set ws = Sheet1
With ws
'// Clear any set filters
'// AutoFilters
.AutoFilterMode = False
If .FilterMode Then .ShowAllData
'// Create the filtered range for Column A
Set cFilterRange = .Range("I1:I" & Sheet1.Range("I" & Rows.Count).End(xlUp).Row)
'// Apply a unique filter to Col A
cFilterRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
'// Now add only those visible rows - Using Col A here
For Each c In cFilterRange.SpecialCells(xlCellTypeVisible)
If c.Row <> 1 Then
tv.Nodes.Add , , c.Value, c.Value
End If
Next
.ShowAllData
Set cFilterRange = Nothing
Set cFilterRange = .Range("B1:B" & Sheet1.Range("I" & Rows.Count).End(xlUp).Row)
cFilterRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
For Each c In cFilterRange.SpecialCells(xlCellTypeVisible)
If c.Row <> 1 Then
Set nParent = tv.Nodes(c.Offset(0, 7).Value)
tv.Nodes.Add nParent, tvwChild, c.Value, c.Value
End If
Next
End With
ErrHandler:
tv.Top = 24
Application.ScreenUpdating = True
tv.Top = 24
End Sub