offset listbox selection

tonyBruckner

New Member
Joined
Apr 18, 2002
Messages
21
Given: a userform with a listbox and an ok button. The listbox lists these names:

jane doe
john doe
jill doe
jim doe

User selects jane, jane is stored in a variable. User clicks OK and an operation is performed. User is now ready for john but must select him manually.

Is there a command that will offset the listbox selection down one?

thanks in advance
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
In a vb user form the following code was inserted into a command button. Every time the command button was clicked the selected item in the combobox was incremented by 1. Is that what your looking for ?
Code:
Private Sub CommandButton1_Click()
ComboBox1.ListIndex = ComboBox1.ListIndex + 1
End Sub
 
Upvote 0
The following VB code will remove the item from the ComboBox list:
Code:
Private Sub CommandButton1_Click()
ComboBox1.RemoveItem (ComboBox1.ListIndex)
ComboBox1.ListIndex = 0
End Sub
 
Upvote 0
Juan Pablo González said:
What do you mean by Offset in there ? remove it from the list ? select the next entry in the list ?

by "offset" I mean move down one, selecting the next entry in the list. If the list is for instance a roll call, then names must be checked in sequence one at a time
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top