Consulting

Results 1 to 2 of 2

Thread: Conditional adding to a tree view

  1. #1
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location

    Conditional adding to a tree view

    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?

    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

  2. #2
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •