selecting cells in a range to populate a comboBox RRS feed

  • Question

  • I have a table "Sample" with 3 columns. (Column1 ... 3)

    Using VBA I want to iterate through each row in Column3 and if cell value = test criteria then add the value in Column1 of the same row to the ComboBox list.

    For each row in table

    if cell(row,3) = criteria then

    ComboBox.AddItem cell(row,1).Value

    Next row

    Excel 2007

    Sunday, October 19, 2014 1:44 AM


  • Solved

    Dim cell As Range
        For Each cell In Range("Sample[Column1]")
            If cell.Offset(0, 2) = Criteria Then
                ComboBox.AddItem cell.Value
            End If
        Next cell

    Sunday, October 19, 2014 4:42 AM