Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try adding .Value at the end of the Combobox in the If...Then statement.
Like this: Private Sub MyComboBox_Change() If MyComboBox.Value = test1 Then Range("B1").Formula = "=Sheet2!A1" Else Range("B1").Value = "" MsgBox "B1 has no data source.", vbInformation End If End Sub -- Cheers, Ryan "Silvio" wrote: Ryan, I inserted a break to debug the code and it always tells me that MyComboBox = Empty "Ryan H" wrote: Assuming you named your Combobox MyComboBox this should work for you. Put this code into the ComboBox_Change Event. This will fire each time someone changes the combobox value. Hope this helps! If so, let me know, click "YES" below. Private Sub MyComboBox_Change() If MyComboBox = test1 Then Range("B1").Formula = "=Sheet2!A1" Else Range("B1").Value = "" MsgBox "B1 has no data source.", vbInformation End If End Sub -- Cheers, Ryan "Silvio" wrote: Hello, I would like to change a cell source base once a selection made from a combo box. After making a selection from the combo box the code should do something like: If MyComboBox = test1 then B1 = Sheet2!A1 Else B1 has no data source (null) End if Whats the easiest way to accomplish my goal in Excel 2007? PS. B1 is the cell in my fist Sheet. Thank you, Silvio |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
combo box question | Excel Programming | |||
Combo Box Question | Excel Worksheet Functions | |||
Combo Box Question | Excel Programming | |||
Combo box question | Excel Programming | |||
Combo Box Question | Excel Programming |