|
- Private Sub UserForm_Initialize()
- With Sheet3
- r = .Range("a65536").End(xlUp).Row
- ar = .Range("a2:w" & r)
- End With
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Me.TreeView1
- .Style = tvwTreelinesPlusMinusPictureText
- .LineStyle = tvwRootLines
- .ImageList = ImageList1
- .Nodes.Clear
- .Nodes.Add , , "top", "我的学校", 1
- If r < 3 Then Exit Sub
- For i = 2 To r - 1
- If Not d.exists(ar(i, 1)) Then
- d(ar(i, 1)) = s
- .Nodes.Add "top", tvwChild, ar(i, 1), ar(i, 1), 2
- End If
- If Not d1.exists(ar(i, 1) & ar(i, 5)) Then
- d1(ar(i, 1) & ar(i, 5)) = s
- .Nodes.Add ar(i, 1), tvwChild, ar(i, 5), ar(i, 5), 2
- End If
- .Nodes.Add ar(i, 5), tvwChild, , ar(i, 3), 4
- Next
- End With
- Set d = Nothing
- Set d1 = Nothing
- End Sub
复制代码 |
|