Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Combobox Item Number

Lets say there are 20 items that can possible be chosen
out of a combobox. Lets say I selected the
value "April". The value April is the 4th item in the
combobox. What is the code that will return 4? I just
need a code that will return the location number of the
value that I selected.


Thank you
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Combobox Item Number

ComboBox1.ListIndex + 1

(The index is zero-based, so the first item has a ListIndex of 0).

--

Vasant




"Todd Huttenstine" wrote in message
...
Lets say there are 20 items that can possible be chosen
out of a combobox. Lets say I selected the
value "April". The value April is the 4th item in the
combobox. What is the code that will return 4? I just
need a code that will return the location number of the
value that I selected.


Thank you
Todd Huttenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Combobox Item Number

Hi Todd

Combo1.ListIndex + 1

(since item 1 is listindex 0 )

HTH. Best wishes Harald

"Todd Huttenstine" skrev i melding
...
Lets say there are 20 items that can possible be chosen
out of a combobox. Lets say I selected the
value "April". The value April is the 4th item in the
combobox. What is the code that will return 4? I just
need a code that will return the location number of the
value that I selected.


Thank you
Todd Huttenstine



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Combobox Item Number

Hah ... beat you to it!

I must be feeling better ... :)

Regards,

Vasant.

"Harald Staff" wrote in message
...
Hi Todd

Combo1.ListIndex + 1

(since item 1 is listindex 0 )

HTH. Best wishes Harald

"Todd Huttenstine" skrev i melding
...
Lets say there are 20 items that can possible be chosen
out of a combobox. Lets say I selected the
value "April". The value April is the 4th item in the
combobox. What is the code that will return 4? I just
need a code that will return the location number of the
value that I selected.


Thank you
Todd Huttenstine





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox Item Number

If you mean VB, you can use the listindex

i = Combo1.Listindex

One thing to note is that the listindex property is zero based, so i
you are looking for the fourth item in the list, it will have
listindex of 3.

Also, to get the value for an item where you know the listindex, yo
would use:

strValue = Combo1.List(1)

Which would retrieve the second value in your list.

K

Edit: Way too slow I see..

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Combobox Item Number

"Vasant Nanavati" <vasantn *AT* aol *DOT* com skrev i melding
...

Hah ... beat you to it!

Bah. Fix your system clock! <bg

I must be feeling better ... :)

Glad to hear that Vasant.

Best wishes Harald


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use match function to add different item in Combobox Leonard Lan Excel Worksheet Functions 2 September 9th 09 06:26 PM
item limit for a combobox? KarenH Excel Worksheet Functions 3 July 20th 06 09:30 PM
Combobox Number Formats LostInVBA Excel Worksheet Functions 0 June 30th 05 09:11 PM
Disable item in combobox Peter Pantus Excel Programming 2 December 30th 03 07:46 PM
ComboBox and select item Soniya Excel Programming 5 August 23rd 03 11:18 AM


All times are GMT +1. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"