LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Populating a combobox

The ComboBox can pick up the descriptions along the item numbers. That
will make it easier to get the description for a given item number.
The user doesn't have to see it. Set the ComboBox's ColumnCount to 2
and the 2nd column's width to 0, e.g. ColumnWidths = 30 pts; 0 pts. I
assume you have a CommandButton the user clicks to indicate having
selected an Item Number and quantity. Assuming this, something like
the following code should work.

Private Sub CommandButton1_Click()
Dim iRow As Integer
iRow = 1 + Sheets("Order").Range("A65536").End(xlUp).Row
Sheets("Order").Cells(iRow, 1) = ComboBox1.List(ComboBox1.ListIndex,
0)
Sheets("Order").Cells(iRow, 2) = CInt(TextBox1.Value)
Sheets("Order").Cells(iRow, 3) = ComboBox1.List(ComboBox1.ListIndex,
1)
End Sub

Private Sub UserForm_Activate()
Dim iCt As Integer
Dim r As Range
iCt = Sheets("Items").Range("M1")
Set r = Sheets("Items").Range("A3:B" & iCt + 2)
ComboBox1.RowSource = r.Worksheet.Name & "!" & r.Address
End Sub

Hth,
Merjet

 
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
Populating a ComboBox in a UserForm I Maycotte[_5_] Excel Programming 2 June 27th 06 06:28 PM
Populating a ComboBox DirInfo Excel Programming 1 March 17th 05 10:03 PM
Populating Combobox Methods Todd Huttenstine[_2_] Excel Programming 10 January 18th 04 10:19 PM
populating a combobox on a worksheet Tim Marsh[_2_] Excel Programming 2 November 3rd 03 12:44 PM


All times are GMT +1. The time now is 12:39 PM.

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"