I have a workbook containing 3 modules and 2 user forms. 1 user form (named Animals) contains a combobox to allow the user to select an animal. I don’t show the initialization step where I populate the combobox (named Animal_List) but that is working fine. Below are the details that pertain to my question:
Module1:
Public critter as String
_______________________
Sub Zoo ()
Code
.
.
Animals.Show
Sheets(“List”).Select
Activecell = critter
.
.
.
End Sub
Animals (userform1):
Private Sub Animal_List_Change()
Rownumber = Animal_List.ListIndex
Sheets(“Database”).Select
Range(“B7”).Activate
Activecell.Offset(Rownumber, 0).Activate
Module1.critter = Activecell.Text
End Sub
So the user chooses an animal from the combobox, and I want to copy that animal’s name to another worksheet. This worked fine yesterday, but as of this morning when I run the macro I get an error when Private Sub Animal_List_Change() is activated (after the user chooses the animal from the combobox). The error says: “Compile Error: Method or data member not found” and it highlights the word critter within the Animal_List_Change() function. I changed the name of my variable in all 3 places that it is used above to ensure I didn’t use it elsewhere, but that didn’t fix the problem. I did add a second userform that cannot be activated while the first is running (it allows you to replace an animal that was already chosen in worksheet List with another animal), but I still think that this macro was working fine after those additions. I am at a complete loss since I had everything working correctly yesterday. Any help is greatly appreciated.
Bookmarks