Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Two values in a combobox

Hi
If i use
For Each b In rng3
combo_timer.AddItem b.Text
next

is there away to say the values are somthing and the tex are something else
like in a combobox in a database where what you see in the combobox are
text and the value are numbers.

In my case here i only give combo_timer a value B in rng3 but is there a way
to give another value also like text is somthing and the valuea are somthing?

regards

alvin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Two values in a combobox

alvin,

Use two columns in the combo box.
Set the width of the second column to zero.
Set the second column as the bound column.
Put the data you want to display in the first column.
Put the data you want to use in the second column.

After doing the above then this worked for me...

Private Sub ComboBox1_Change()
'Adds the data from column two to the cell.
Range("A2").Value = ComboBox1.Value
End Sub

'Loads both columns with data from the range.
Private Sub UserForm_Initialize()
Dim varValues As Variant
varValues = Range("C5:D15").Value
ComboBox1.List = varValues
'-----------------------------------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"alvin Kuiper"
wrote in message...
Hi
If i use
For Each b In rng3
combo_timer.AddItem b.Text
next
is there away to say the values are somthing and the tex are something else
like in a combobox in a database where what you see in the combobox are
text and the value are numbers.
In my case here i only give combo_timer a value B in rng3 but is there a way
to give another value also like text is somthing and the valuea are somthing?
regards
alvin


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Two values in a combobox

Thanks

Alvin

"Jim Cone" wrote:

alvin,

Use two columns in the combo box.
Set the width of the second column to zero.
Set the second column as the bound column.
Put the data you want to display in the first column.
Put the data you want to use in the second column.

After doing the above then this worked for me...

Private Sub ComboBox1_Change()
'Adds the data from column two to the cell.
Range("A2").Value = ComboBox1.Value
End Sub

'Loads both columns with data from the range.
Private Sub UserForm_Initialize()
Dim varValues As Variant
varValues = Range("C5:D15").Value
ComboBox1.List = varValues
'-----------------------------------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"alvin Kuiper"
wrote in message...
Hi
If i use
For Each b In rng3
combo_timer.AddItem b.Text
next
is there away to say the values are somthing and the tex are something else
like in a combobox in a database where what you see in the combobox are
text and the value are numbers.
In my case here i only give combo_timer a value B in rng3 but is there a way
to give another value also like text is somthing and the valuea are somthing?
regards
alvin



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
Values of ComboBox fields and SQL Ant(antonfh_at_gmail_dot_com) Excel Discussion (Misc queries) 3 May 23rd 06 02:03 PM
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
Combobox and data values fragher75[_8_] Excel Programming 1 October 20th 04 01:15 PM
ComboBox Values Jim Berglund Excel Programming 4 August 17th 04 10:18 PM
ComboBox Values Darren[_3_] Excel Programming 1 July 16th 03 10:41 AM


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

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

About Us

"It's about Microsoft Excel"