ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refering to 2nd Column in a Combobox (https://www.excelbanter.com/excel-programming/382648-refering-2nd-column-combobox.html)

Corey

Refering to 2nd Column in a Combobox
 
When using a Combobox with more than 1 CoumnCounts :

If i use the "ComboBox2.Value" line i get the Value in Column 1
How do i refer to the 2nd Column ?

Combobox2(Column(2).Value ??


Corey....



merjet

Refering to 2nd Column in a Combobox
 
MsgBox ComboBox2.List(2, 1)
will give the 3rd row, 2nd column (since the base is 0) of ComboBox2.
ComboBox2.Value would give you the value in the BoundColumn of the
selected row.

Hth,
Merjet


Corey

Refering to 2nd Column in a Combobox
 
So how do i get the Value in the 2nd column not the boundcolumn?
The MsgBox ComboBox2.List(2, 1) sems to give me a irrellevant value??
"merjet" wrote in message
oups.com...
MsgBox ComboBox2.List(2, 1)
will give the 3rd row, 2nd column (since the base is 0) of ComboBox2.
ComboBox2.Value would give you the value in the BoundColumn of the
selected row.

Hth,
Merjet



merjet

Refering to 2nd Column in a Combobox
 
Corey,

I checked what I wrote in #2 and it was accurate.

I can't see what you do to get your results. If you want to send an
Excel file to my e-mail address, maybe with some guidance on how to
replicate what you are doing, I will take a look.

Merjet



Corey

Refering to 2nd Column in a Combobox
 
So if i have 2 columns in Combobox2 and the Values Chosen(Displayed) was:

ALPHABET SOUP


On a msg & Combobox2.value would display ALPHABET


If i wanted to display BOTH values i would do what:

Msg & Combobox2.value & Combobox2.(List2,1)

To show :

ALPHABET SOUP in the MSG???




"merjet" wrote in message
oups.com...
Corey,

I checked what I wrote in #2 and it was accurate.

I can't see what you do to get your results. If you want to send an
Excel file to my e-mail address, maybe with some guidance on how to
replicate what you are doing, I will take a look.

Merjet




merjet

Refering to 2nd Column in a Combobox
 
Either of these should work:
1. MsgBox ComboBox2.Value & " " & ComboBox2.List(ListIndex, 1)
if BoundColumn = 1 and ALPHABET in selected row
2. MsgBox ComboBox2.List(2,0) & " " & ComboBox2.List(2, 1)
if ALPHABET in the 3rd row (2nd since counting starts with 0)

Merjet



Corey

Refering to 2nd Column in a Combobox
 
I have the BoundColumn =2
ColumnCount=2
And ALPHABET is on the LEFT SIde of the Combobox.

I still seem to get illogical numerical values in the other value in the msg.

Whe
ALPHABET SOUP


I get

ALPHABET 13


??


Using :


MsgBox & ComboBox2.Value & " " & ComboBox2.List(2, 0)


"merjet" wrote in message
oups.com...
Either of these should work:
1. MsgBox ComboBox2.Value & " " & ComboBox2.List(ListIndex, 1)
if BoundColumn = 1 and ALPHABET in selected row
2. MsgBox ComboBox2.List(2,0) & " " & ComboBox2.List(2, 1)
if ALPHABET in the 3rd row (2nd since counting starts with 0)

Merjet




Tom Ogilvy

Refering to 2nd Column in a Combobox
 

sVal1 = "": sVal2=""
With Combobox2
if .ListIndex < -1 then
sVal2 = .List(.ListIndex,1)
sVal1 = .List(.Listindex,0)
end if
End With

msgbox sVal1 & " " & sVal2

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
I have the BoundColumn =2
ColumnCount=2
And ALPHABET is on the LEFT SIde of the Combobox.

I still seem to get illogical numerical values in the other value in the
msg.

Whe
ALPHABET SOUP


I get

ALPHABET 13


??


Using :


MsgBox & ComboBox2.Value & " " & ComboBox2.List(2, 0)


"merjet" wrote in message
oups.com...
Either of these should work:
1. MsgBox ComboBox2.Value & " " & ComboBox2.List(ListIndex, 1)
if BoundColumn = 1 and ALPHABET in selected row
2. MsgBox ComboBox2.List(2,0) & " " & ComboBox2.List(2, 1)
if ALPHABET in the 3rd row (2nd since counting starts with 0)

Merjet







All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com