Consulting

Results 1 to 4 of 4

Thread: ListBox1_Click to select an item on a worksheet

  1. #1
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location

    ListBox1_Click to select an item on a worksheet

    I'm currently populating a Listbox in a userform like this:

                    With ListBox1
                                        .AddItem rngFind.Address                         ' Cell Address
                                        .List(.ListCount - 1, 1) = (Cells(loc, 1))       ' First Column of found row
                                        .List(.ListCount - 1, 2) = (Cells(1, Col))       
                                                                            
                                    End With
    rngFind.Address is the result of a search in the UserForm

    How can I select the rngFind.Address on Sheet1 when the user clicks that listbox item in the Userform ?

    It needs to go into the Private Sub ListBox1_Click() Module.

    Thanks

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Sheets("Sheet1").Range(Me.ListBox1.Value).Select
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    SamT:

    I looked at this and wondered why my version DID NOT WORK.
    I was accessing the wrong worksheet among other things. Duhhhhh!
    Your version worked great as expected.
    Thanks

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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