![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
What do you mean by Offset in there ? remove it from the list ? select the next entry in the list ?
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
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 |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
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 |
|
|
|
|
|
#5 | |
|
New Member
Join Date: Apr 2002
Posts: 21
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|