Results 1 to 5 of 5

ListBox Problem...

Threaded View

  1. #1
    Registered User
    Join Date
    07-23-2008
    Location
    Selangor
    Posts
    18

    ListBox Problem...

    i'm designing a form using macro. but i stuck when i want to view data from excel in list box.

    Name: ListBox1
    ColumnCount: 100
    ColumnBound: 100

    The function:
    when user click on cmbFindAll, all particular data for particular comName are listed in TextBox1. it's successful if only till 9th column. when i tried to put 10th column, the error will be occurred.
    could not set list property. invalid property value
    this is my coding

    Sub cmbFindAll_Click()
        Dim strFind As String    'what to find
        Dim rFilter As Range     'range to search
        Set rFilter = Sheet1.Range("a8", Range("d65536").End(xlUp))
        Set rng = Sheet1.Range("a7", Range("a65536").End(xlUp))
        strFind = Me.comName.Value
        With Sheet1
            If Not .AutoFilterMode Then .Range("A8").AutoFilter
            rFilter.AutoFilter Field:=1, Criteria1:=strFind
            Set rng = rng.Cells.SpecialCells(xlCellTypeVisible)
            Me.ListBox1.Clear
            For Each c In rng
                With Me.ListBox1
                    .AddItem c.Value
    
                    .List(.ListCount - 1, 1) = c.Offset(0, 1).Value
                    .List(.ListCount - 1, 2) = c.Offset(0, 2).Value
                    .List(.ListCount - 1, 3) = c.Offset(0, 3).Value
                    .List(.ListCount - 1, 4) = c.Offset(0, 4).Value
                    .List(.ListCount - 1, 5) = c.Offset(0, 5).Value
                    .List(.ListCount - 1, 6) = c.Offset(0, 6).Value
                    .List(.ListCount - 1, 7) = c.Offset(0, 7).Value
                    .List(.ListCount - 1, 8) = c.Offset(0, 8).Value
                    .List(.ListCount - 1, 9) = c.Offset(0, 9).Value
                    .List(.ListCount - 1, 10) = c.Offset(0, 10).Value
                                  
                
                End With
            Next c
        End With
    End Sub
    Last edited by VBA Noob; 07-31-2008 at 01:30 AM.

Thread Information

Users Browsing this Thread

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

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