Please see attached file. I've created a combo box that is linked to a cell such that whatever listing is visible in the combo box also appears in the linked cell (E2). I have recorded a macro that sorts for "goat"s in a column of animals. I need to know how to call this macro when the linked cell reads "Dehorn goats". (BTW, these are all just silly examples to illustrate my challenge with a much bigger spreadsheet....)
Here's what's curious: when I select "Dehorn goats" in the combobox list it does not perform the sorting. But, after selecting this, if I then click on random cells, the second or third cell I double click runs the macro. I cannot figure out why, and there doesn't seem to be a consistent pattern in which cells work to activate the macro, either. Very strange. What am I doing wrong? I sense it has something to do with the recorded macro being in a Module rather than the sheet I'm working in, but I've tried cutting and pasting it into the sheet code with no luck.
Below is the macro I've scripted to call the SortGoat macro I recorded. (and which does work when run on its own...)
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("E2")
If Target.Value = "Dehorn goat" Then
Call SortGoat
End If
End Sub
Thanks for your help, I really need it. David
Bookmarks