Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have what I think is going to be an easy (easier anyway) question. I
have an excel spreadsheet with about 1000 rows of data with 3 columns. I have a userform setup with a combo box. What I would like to see, is when a value from the combo box is entered (from column A) I would like that value of a text box to show the item found in Column B of the same row. So if the value is from A600, then the value in the textbox is from B600. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you can give this a try. it's a userform with 1 combobox and 2 textboxes.
when you enter or choose a value from the combobox, the values from that row in columns B and C are entered into the 2 textboxes if you don't want to fire on change, but when the combobox is exited, then use: Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) as the first line instead. Private Sub ComboBox1_Change() Dim ws As Worksheet Dim lastrow As Long, frow As Long, rng As Range, rngfound As Range Set ws = Worksheets("Sheet1") lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row frow = ws.Range("A1").Row Set rng = ws.Range("A" & frow & ":A" & lastrow) Application.ScreenUpdating = False Application.Calculation = xlCalculationManual With rng On Error Resume Next Set rngfound = .Find(What:=Me.ComboBox1.Value, LookIn:=xlValues, _ LookAt:=xlWhole) If Not rngfound Is Nothing Then With Me .TextBox1.Value = Range("B" & rngfound.Row) .TextBox2.Value = Range("C" & rngfound.Row) End With Else MsgBox "Item number not found." Me.ComboBox1.Value = "" Exit Sub End If End With Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub -- Gary wrote in message ups.com... I have what I think is going to be an easy (easier anyway) question. I have an excel spreadsheet with about 1000 rows of data with 3 columns. I have a userform setup with a combo box. What I would like to see, is when a value from the combo box is entered (from column A) I would like that value of a text box to show the item found in Column B of the same row. So if the value is from A600, then the value in the textbox is from B600. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
short cut needed for listbox(sorry a bit long) | Excel Programming | |||
userform listbox cannot get listbox.value to transfer back to main sub | Excel Programming | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
Soup to nuts listbox help needed | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming |