Excel VBA Macro Sub or Function not defined
68,228
Solution 1
- 1st - check if there's no missing reference in the VBA project.
- 2nd - It seems it needs the Solver Addin. Ensure it's checked in Excel Addins.
Solution 2
This answer is pretty late (I'm a new arrival to SuperUser). You need to go to VBA editor screen, choose References... from the Tools menu, find Solver and check the box to allow VBA to use Solver references in your code.
Related videos on Youtube
Author by
wdkrnls
Updated on September 18, 2022Comments
-
wdkrnls over 1 year
I used the macro recorder to generate a macro in Excel 2007. When I try to the run the macro, it tells me:
When I click
Ok
the definition of the macro gets highlighted.I'm really confused about why VBA would throw this error. I just defined it! Do you have any ideas what I did wrong?
-
wdkrnls about 13 yearsI'll check this out. I didn't think about references. Hopefully that is it. Thanks.
-
wdkrnls about 13 yearsYou were right. I didn't add Solver to the references for the project. Thanks.
-
Raystafarian about 12 yearsDo you know what this does when you do it?