I've moved on a little from the above and tried to adapt it
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'B9 is the linked cell for the first combobox
Select Case Range("B9")
Case "Yes"
ComboBox2.Value = "Banana"
Case "No"
ComboBox2.Value = "Pear"
Case Else
ComboBox2.Value = "Apple"
End Select
End Sub
but it still isn't happy. Ideally the second combobox would actually be a data validation drop down but whoever I can get working I'll be happy with!
Incidentally I managed to link a list box to a combo box with this code
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'B3 is data validation list
Select Case Range("B3")
Case "Yes"
Sheets("Sheet1").ComboBox1.Value = "Thursday"
Sheets("Sheet1").ComboBox2.Value = "Banana"
Case "No"
Sheets("Sheet1").ComboBox1.Value = "Friday"
Sheets("Sheet1").ComboBox2.Value = "Pear"
Case Else
Sheets("Sheet1").ComboBox1.Value = "Saturday"
Sheets("Sheet1").ComboBox2.Value = "Apple"
End Select
'B9 is data validation list
Select Case Range("B9")
Case "Yes"
Sheets("Sheet1").ComboBox3.Value = "Banana"
Case "No"
Sheets("Sheet1").ComboBox3.Value = "Pear"
Case Else
Sheets("Sheet1").ComboBox3.Value = "Apple"
End Select
End Sub
I've tried both of these on the 'ThisWorkbook' and 'Sheet1' locations in the VBA window
Are they in the correct place?
Bookmarks