Grabbing Data From Second Combo Box Column  
Author Message
E70925





PostPosted: Tue May 17 19:30:20 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column

Hello,
Can one of you masters show me the syntax for grabbing the data out of the
second column of my two-column combo box?

My combo box is called cmbxCustomerSelection and the
cmbxCustomerSelection.text property returns the first column's data.
But how can I access the second column's data?

Thanks,
DBAL.

Excel516  
 
 
Dave





PostPosted: Tue May 17 19:30:20 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column I put a combobox in a userform and added a couple of commandbuttons. This is
the code I used:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
With Me.ComboBox1
If .ListIndex > -1 Then
MsgBox (.List(.ListIndex, 1))
End If
End With
End Sub
Private Sub UserForm_Initialize()
With Me.ComboBox1
.ColumnCount = 2
.RowSource _
= Worksheets("sheet1").Range("a1:B10").Address(external:=True)
End With
End Sub

And it seemed to work ok for me.


>
> Hello,
> Can one of you masters show me the syntax for grabbing the data out of the
> second column of my two-column combo box?
>
> My combo box is called cmbxCustomerSelection and the
> cmbxCustomerSelection.text property returns the first column's data.
> But how can I access the second column's data?
>
> Thanks,
> DBAL.

--

Dave Peterson
 
 
Kevin





PostPosted: Tue May 17 19:31:02 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column Hi,

You are not specific about the data type in use however you can use the
following function is Excel

1. = VLOOKUP(valuto_to_be_looked_up,Dataare(could be a name or referance
like B3:F8,columan number)
= lookup
= hlookup


Foe more details you can use MS Office assistance




> Hello,
> Can one of you masters show me the syntax for grabbing the data out of the
> second column of my two-column combo box?
>
> My combo box is called cmbxCustomerSelection and the
> cmbxCustomerSelection.text property returns the first column's data.
> But how can I access the second column's data?
>
> Thanks,
> DBAL.
>
 
 
DBAL





PostPosted: Tue May 17 19:43:06 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column So would it be something like this??:
Sheet1.cmbxCustomerSelection.List(ListIndex, 1)

By the way, both colums are characters. The first column is the company
name and the second column is the customer number. Also, I need to keep the
.text property to column 1, but just be able to get the data out of column2.

Thanks everyone!




> I put a combobox in a userform and added a couple of commandbuttons. This is
> the code I used:
>
> Option Explicit
> Private Sub CommandButton1_Click()
> Unload Me
> End Sub
> Private Sub CommandButton2_Click()
> With Me.ComboBox1
> If .ListIndex > -1 Then
> MsgBox (.List(.ListIndex, 1))
> End If
> End With
> End Sub
> Private Sub UserForm_Initialize()
> With Me.ComboBox1
> .ColumnCount = 2
> .RowSource _
> = Worksheets("sheet1").Range("a1:B10").Address(external:=True)
> End With
> End Sub
>
> And it seemed to work ok for me.
>

> >
> > Hello,
> > Can one of you masters show me the syntax for grabbing the data out of the
> > second column of my two-column combo box?
> >
> > My combo box is called cmbxCustomerSelection and the
> > cmbxCustomerSelection.text property returns the first column's data.
> > But how can I access the second column's data?
> >
> > Thanks,
> > DBAL.
>
> --
>
> Dave Peterson
>
 
 
DBAL





PostPosted: Tue May 17 19:56:01 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column Just wanted to say thanks... I got it working. This was the answer:
Sheet1.cmbxCustomerSelection.List(Sheet1.cmbxCustomerSelection.ListIndex, 1)

DBAL




> So would it be something like this??:
> Sheet1.cmbxCustomerSelection.List(ListIndex, 1)
>
> By the way, both colums are characters. The first column is the company
> name and the second column is the customer number. Also, I need to keep the
> .text property to column 1, but just be able to get the data out of column2.
>
> Thanks everyone!
>
>

>
> > I put a combobox in a userform and added a couple of commandbuttons. This is
> > the code I used:
> >
> > Option Explicit
> > Private Sub CommandButton1_Click()
> > Unload Me
> > End Sub
> > Private Sub CommandButton2_Click()
> > With Me.ComboBox1
> > If .ListIndex > -1 Then
> > MsgBox (.List(.ListIndex, 1))
> > End If
> > End With
> > End Sub
> > Private Sub UserForm_Initialize()
> > With Me.ComboBox1
> > .ColumnCount = 2
> > .RowSource _
> > = Worksheets("sheet1").Range("a1:B10").Address(external:=True)
> > End With
> > End Sub
> >
> > And it seemed to work ok for me.
> >

> > >
> > > Hello,
> > > Can one of you masters show me the syntax for grabbing the data out of the
> > > second column of my two-column combo box?
> > >
> > > My combo box is called cmbxCustomerSelection and the
> > > cmbxCustomerSelection.text property returns the first column's data.
> > > But how can I access the second column's data?
> > >
> > > Thanks,
> > > DBAL.
> >
> > --
> >
> > Dave Peterson
> >
 
 
Dave





PostPosted: Wed May 18 08:15:31 CDT 2005 Top

Excel Programming >> Grabbing Data From Second Combo Box Column I didn't realize it was a combobox on the worksheet.

You could save a little typing:

with Sheet1.cmbxCustomerSelection
msgbox .List(.ListIndex, 1)
end with

I think it makes it easier to read, too.


>
> Just wanted to say thanks... I got it working. This was the answer:
> Sheet1.cmbxCustomerSelection.List(Sheet1.cmbxCustomerSelection.ListIndex, 1)
>
> DBAL
>

>
> > So would it be something like this??:
> > Sheet1.cmbxCustomerSelection.List(ListIndex, 1)
> >
> > By the way, both colums are characters. The first column is the company
> > name and the second column is the customer number. Also, I need to keep the
> > .text property to column 1, but just be able to get the data out of column2.
> >
> > Thanks everyone!
> >
> >

> >
> > > I put a combobox in a userform and added a couple of commandbuttons. This is
> > > the code I used:
> > >
> > > Option Explicit
> > > Private Sub CommandButton1_Click()
> > > Unload Me
> > > End Sub
> > > Private Sub CommandButton2_Click()
> > > With Me.ComboBox1
> > > If .ListIndex > -1 Then
> > > MsgBox (.List(.ListIndex, 1))
> > > End If
> > > End With
> > > End Sub
> > > Private Sub UserForm_Initialize()
> > > With Me.ComboBox1
> > > .ColumnCount = 2
> > > .RowSource _
> > > = Worksheets("sheet1").Range("a1:B10").Address(external:=True)
> > > End With
> > > End Sub
> > >
> > > And it seemed to work ok for me.
> > >

> > > >
> > > > Hello,
> > > > Can one of you masters show me the syntax for grabbing the data out of the
> > > > second column of my two-column combo box?
> > > >
> > > > My combo box is called cmbxCustomerSelection and the
> > > > cmbxCustomerSelection.text property returns the first column's data.
> > > > But how can I access the second column's data?
> > > >
> > > > Thanks,
> > > > DBAL.
> > >
> > > --
> > >
> > > Dave Peterson
> > >

--

Dave Peterson