Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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(exter nal:=True)
End With
End Sub

And it seemed to work ok for me.

DBAL wrote:

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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


"DBAL" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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!


"Dave Peterson" wrote:

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(exter nal:=True)
End With
End Sub

And it seemed to work ok for me.

DBAL wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Grabbing Data From Second Combo Box Column

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

DBAL


"DBAL" wrote:

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!


"Dave Peterson" wrote:

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(exter nal:=True)
End With
End Sub

And it seemed to work ok for me.

DBAL wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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.

DBAL wrote:

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

DBAL

"DBAL" wrote:

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!


"Dave Peterson" wrote:

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(exter nal:=True)
End With
End Sub

And it seemed to work ok for me.

DBAL wrote:

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
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
Keeps grabbing more than one cell/column confused Excel Worksheet Functions 1 March 11th 09 03:42 PM
Grabbing data between worksheets andrew Excel Discussion (Misc queries) 4 July 7th 08 05:39 AM
grabbing data from another website [email protected] Excel Discussion (Misc queries) 1 July 4th 08 08:26 PM
Grabbing data from 1 sheet to place in another prem New Users to Excel 1 May 3rd 08 12:47 PM
Grabbing data from a specific cell *Kenneth* Excel Worksheet Functions 2 March 18th 08 10:31 PM


All times are GMT +1. The time now is 02:25 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"