PDA

View Full Version : [SOLVED] Conditional adding to a tree view



gibbo1715
09-16-2005, 12:56 PM
I am trying to figure out how to add an item to a tree view only if the value in column E is y

Im trying the code below which doesnt cause an error but also doesnt work,

can anyone assist please,

works fine without the "If Cells(t, 4).Value = "y" Then " line?:banghead:


Dim i As Integer
i = Sheets("Customer").Range("A63556").End(xlUp).Row
With TreeView1.Nodes
Set X = .Add(, , "Customer", "Customer")
For t = 2 To i
If Cells(t, 4).Value = "y" Then
Set X = .Add("Policies", 4, , Sheets("Customer").Cells(t, 1))
End If
Next
End With
AddCounter
Set X = Nothing

Thanks again

Gibbo

gibbo1715
09-16-2005, 01:08 PM
ok, i see, it should be the column number not the offset

Doh !!!!!



' row and column number ********************
If Cells(t, 4).Value = "y" Then


thanks for looking

gobbi