Thread: Combobox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Green[_2_] John Green[_2_] is offline
external usenet poster
 
Posts: 58
Default Combobox

Scott,

Use the change or click event of the combobox to assign the value to a cell. The following code assigns the selected value to a cell
on the same row as the active cell in the D column.

Private Sub ComboBox1_Change()
Cells(ActiveCell.Row, "D").Value = ComboBox1.Text
End Sub


--

John Green - Excel MVP
Sydney
Australia


"Scott" wrote in message ...
I keep getting intermittent error when trying to assign
the LinkedCell value to a combo box. I want the linked
value to be in the current row so I put the code in the
Worksheet_Selection Change event.

Select Case obj.Name
Case Is = "ComboBox7"


Case Else
obj.LinkedCell = Cells(theRow, theCol).Address
End Select

This works sometimes but when I select from the drop down
#N/A appears in the linked cell. Other times I get this
error.

Method 'LinkedCell' of object '_OLEObject' failed

I need to put the text value of the drop down in one cell
and the second column value in the next colum. I
populated the drop down with a pre-written list of values
on another sheet.

Would you please include code with your help?

Thank you!

Scott