Results 1 to 16 of 16

Listbox Issues / Errors with UserForm

Threaded View

  1. #1
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Listbox Issues / Errors with UserForm

    I am having a few issues with a userform attached. I would first like to thank Roy UK for the link to the VB and website http://www.excel-it.com/vba_examples.htm this has helped me out no end but I have a few issues that I have tried to solve but have come up against walls all over the place.

    1. ListBox1 – if there is any more then 1 record found then I keep getting errors unless I have remove .TextBox10.Value = ListBox1.List(R, 9) upwards.

    Private Sub ListBox1_Click()
        If Me.ListBox1.ListIndex = -1 Then    'not selected
            MsgBox " No selection made"
        ElseIf Me.ListBox1.ListIndex >= 1 Then    'User has selected
            R = Me.ListBox1.ListIndex
    
            With Me
                .TextBox1.Value = ListBox1.List(R, 0)
                .TextBox2.Value = ListBox1.List(R, 1)
                .TextBox3.Value = ListBox1.List(R, 2)
                .TextBox4.Value = ListBox1.List(R, 3)
                .TextBox5.Value = ListBox1.List(R, 4)
                .TextBox6.Value = ListBox1.List(R, 5)
                .TextBox7.Value = ListBox1.List(R, 6)
                .TextBox8.Value = ListBox1.List(R, 7)
                .TextBox9.Value = ListBox1.List(R, 8)
                .TextBox10.Value = ListBox1.List(R, 9)
                .TextBox11.Value = ListBox1.List(R, 10)
                .TextBox12.Value = ListBox1.List(R, 11)
                .TextBox13.Value = ListBox1.List(R, 12)
                .cmbDelete.Enabled = True     'allow record deletion
                .cmbAdd.Enabled = False       'don't want duplicate
            End With
            
    
        End If
    End Sub


    2. After removing .TextBox10.Value = ListBox1.List(R, 9) upwards I then get the following issues.
    a. It only deletes the record at the top of the list and not the one that is selected
    b. How to make the ListBox columns narrower.
    c. What code is needed to clear the ListBox.

    I would appreciate all the help that anyone can give me.
    Attached Files Attached Files
    Last edited by Chris270; 08-31-2011 at 02:05 PM. Reason: No response

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