Results 1 to 6 of 6

Populate ComboBox with rows that meet criterion

Threaded View

  1. #1
    Registered User
    Join Date
    10-01-2011
    Location
    Pittsford, NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Populate ComboBox with rows that meet criterion

    Hi, Everyone,
    I have a worksheet that includes 8 columns. Column 2 is the index. Column 3 has IDs.
    Given an ID, I want to know how many rows in the worksheet include the ID in Column 3.
    If more than one row, I want to load each such row into a ComboBox so I can then select the row I want to work with.
    So far, I’ve been able to count the rows that have the ID in question. But I can’t figure out how to load the rows into a ComboBox. I’d be grateful for any help!

    Private Sub cmd3_Click()
    Dim strID As String
    Dim qAuth As Integer
    Dim rng As Range, c
    
    ' [Deleted code to determine and set strID]
    
    ' Determine number of rows associated with strID
    Set rng = Range("Sheet2")
    qAuth = 0
    For c = 2 To rng.Rows.Count
        If rng.Cells(c, 3) = strID Then
        qAuth = qAuth + 1
    'While going through the rows, this might be a good time to gather data for the 
    'ComboBox, but how?
        End If
    Next c
    
    Select Case qAuth
    
    Case 0
    ' [Deleted]
    
    Case 1
    ' [Deleted]
    
    Case Else
    ' Load the ComboBox cbRows in the Form frmSelect (but how?)
    frmSelect.Show
    
    End Select
    
    End Sub
    Last edited by val64; 10-05-2011 at 12:47 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1