Consulting

Results 1 to 4 of 4

Thread: scroll to an item on a list box

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    scroll to an item on a list box

    Hello,

    I am using two listboxes the first fills with column headings and you can press a button with > on it to move it to the second list box

    Multiselect is set to None

    If I select an item in the fist listbox quite far down (there is a vertical scroll bar) I get get it to select the next item by using :-

    .Select(whatever)=True

    but it doesnt show the item in the listbox but instead is back at the top

    Is there a way both to select the item and also show it in the listbox

    I have played around with .selected and .listindex to no avail

    Any help

    Thanks
    Phil

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post the workbook?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Private Sub CommandButton1_Click()
    If ListBox1.ListIndex <> ListBox1.ListCount - 1 Then _
    ListBox1.ListIndex = ListBox1.ListIndex + 1
    End Sub

    Private Sub UserForm_Initialize()
    Dim i As Integer
    For i = 1 To 100
    ListBox1.AddItem i, i - 1
    Next i
    End Sub[/VBA]

  4. #4
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location
    Hello,

    Ignore this post, sorry, it seems to work ok in Excel. Now I am migrating it to Access where it doesnt work!!!!

    As if my life wasnt complicated enough!

    Cheers guys

Posting Permissions

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