Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Stupid question from newbie data from multicolumn combobox

I have a multicolumn (3) combobox that I put data into from a worksheet.
When a user makes a selection, how do I get this data out of it?

Here is how I get the stuff in:

Private Sub UserForm_Initialize()
cmbProducts.ColumnCount = 3

lastproduct = Worksheets("Items").Range("a65536").End(xlUp).Row

For i = 0 To lastproduct - 1

cmbProducts.AddItem
cmbProducts.List(i, 0) = Worksheets("items").Range("a" & i + 1).Value
cmbProducts.List(i, 1) = Worksheets("Items").Range("b" & i + 1).Value
cmbProducts.List(i, 2) = Worksheets("Items").Range("c" & i + 1).Value

Next i

cmbProducts.ListIndex = 0

End Sub

If user chooses list index 3, say, how do I get the three items (which are
item #, description and cost) into three cells in a different worksheet,
"Quote"?

Any help, any suggestions to my code is appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Stupid question from newbie data from multicolumn combobox

Strangely enough:

j = cmbProducts.ListIndex
i = 200
Worksheets("items").Range("a" & i + 1).Value = cmbProducts.List(j, 0)
Worksheets("Items").Range("b" & i + 1).Value = cmbProducts.List(j, 1)
Worksheets("Items").Range("c" & i + 1).Value = cmbProducts.List(j, 2)

--
Regards,
Tom Ogilvy



"mato nanjin" wrote:

I have a multicolumn (3) combobox that I put data into from a worksheet.
When a user makes a selection, how do I get this data out of it?

Here is how I get the stuff in:

Private Sub UserForm_Initialize()
cmbProducts.ColumnCount = 3

lastproduct = Worksheets("Items").Range("a65536").End(xlUp).Row

For i = 0 To lastproduct - 1

cmbProducts.AddItem
cmbProducts.List(i, 0) = Worksheets("items").Range("a" & i + 1).Value
cmbProducts.List(i, 1) = Worksheets("Items").Range("b" & i + 1).Value
cmbProducts.List(i, 2) = Worksheets("Items").Range("c" & i + 1).Value

Next i

cmbProducts.ListIndex = 0

End Sub

If user chooses list index 3, say, how do I get the three items (which are
item #, description and cost) into three cells in a different worksheet,
"Quote"?

Any help, any suggestions to my code is appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Stupid question from newbie data from multicolumn combobox

Tom,

1) Thanks for the help. (I don't know what you mean by "Strangely
enough"). It worked and it is so obvious. but I couldn't find how to do
that anywhere.

2) During a search, I found where you recommended some books for VBA. But I
could not find that again. Would you mind repeating your recommendations?

Thanks again,

ron


"Tom Ogilvy" wrote:

Strangely enough:

j = cmbProducts.ListIndex
i = 200
Worksheets("items").Range("a" & i + 1).Value = cmbProducts.List(j, 0)
Worksheets("Items").Range("b" & i + 1).Value = cmbProducts.List(j, 1)
Worksheets("Items").Range("c" & i + 1).Value = cmbProducts.List(j, 2)

--
Regards,
Tom Ogilvy



"mato nanjin" wrote:

I have a multicolumn (3) combobox that I put data into from a worksheet.
When a user makes a selection, how do I get this data out of it?

Here is how I get the stuff in:

Private Sub UserForm_Initialize()
cmbProducts.ColumnCount = 3

lastproduct = Worksheets("Items").Range("a65536").End(xlUp).Row

For i = 0 To lastproduct - 1

cmbProducts.AddItem
cmbProducts.List(i, 0) = Worksheets("items").Range("a" & i + 1).Value
cmbProducts.List(i, 1) = Worksheets("Items").Range("b" & i + 1).Value
cmbProducts.List(i, 2) = Worksheets("Items").Range("c" & i + 1).Value

Next i

cmbProducts.ListIndex = 0

End Sub

If user chooses list index 3, say, how do I get the three items (which are
item #, description and cost) into three cells in a different worksheet,
"Quote"?

Any help, any suggestions to my code is appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Stupid question from newbie data from multicolumn combobox

Actually I found the book list. Save the typing. Thanks!!!!!!

"Tom Ogilvy" wrote:

Strangely enough:

j = cmbProducts.ListIndex
i = 200
Worksheets("items").Range("a" & i + 1).Value = cmbProducts.List(j, 0)
Worksheets("Items").Range("b" & i + 1).Value = cmbProducts.List(j, 1)
Worksheets("Items").Range("c" & i + 1).Value = cmbProducts.List(j, 2)

--
Regards,
Tom Ogilvy



"mato nanjin" wrote:

I have a multicolumn (3) combobox that I put data into from a worksheet.
When a user makes a selection, how do I get this data out of it?

Here is how I get the stuff in:

Private Sub UserForm_Initialize()
cmbProducts.ColumnCount = 3

lastproduct = Worksheets("Items").Range("a65536").End(xlUp).Row

For i = 0 To lastproduct - 1

cmbProducts.AddItem
cmbProducts.List(i, 0) = Worksheets("items").Range("a" & i + 1).Value
cmbProducts.List(i, 1) = Worksheets("Items").Range("b" & i + 1).Value
cmbProducts.List(i, 2) = Worksheets("Items").Range("c" & i + 1).Value

Next i

cmbProducts.ListIndex = 0

End Sub

If user chooses list index 3, say, how do I get the three items (which are
item #, description and cost) into three cells in a different worksheet,
"Quote"?

Any help, any suggestions to my code is appreciated.


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
Not as stupid a question; this time about data from multiple sheet Ben Karlin Excel Worksheet Functions 1 May 27th 06 12:45 AM
Multicolumn combobox Gromit Excel Programming 2 January 23rd 06 04:14 PM
MultiColumn ComboBox Paul Smith[_3_] Excel Programming 2 August 3rd 05 06:36 AM
MultiColumn ComboBox Value set/display Jim Zeeb[_2_] Excel Programming 5 June 13th 05 09:20 AM
Hiding a column in a multicolumn combobox Mike Jones Excel Programming 1 May 3rd 05 12:44 AM


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