Issue:
When I click a macro assigned button in my workbook the following error appeared:
"User-defined type not defined"
The error box appears, however, it did not highlight any code that may have produced the error. When I ran the macro from the compiler, the code executed without error. I was able to figure out that when I inserted a new button and assigned the same macro to the new button, the code executed without error.
Facts about the workbook:
- The workbook includes multiple macros and multiple sheets as well as buttons linked to most of the macros (6 buttons)
- The workbook is saved daily with a new date as modifications are made. The same button in previous workbooks do not produce this error.
- There was an issue with one button a month ago and it was replaced, now a different button has this same issue. I would like to avoid replacing buttons every time this error occurs as I am not the end user.
- This workbook was originally created in Excel 2010 but I have been using it in Excel 2013, though I made the switch months before this issue (not sure if info is relevant).
I saw a similar issue here, however the issue for me is not in my code, only in the form control. I would just like to know if anyone has seen this before and if there is a way to avoid needing to replace the buttons every time they "go bad."
..._Click()you don't get an error but when you click the button it does? Is the VBA project modified as well or just the sheet contents?commentall lines in the macro and then test the button. Now it should work without a problem. Then start touncommenta few lines and press the button again. Repeat and slowlyuncommentall lines of code until you have found your culprit. Then post the code here and let us know what kind of VBA code can cause such errors. I'd like to know!Personal.XLSB. Then see if you still get this error. If not, then he is right with his assumption. Start to re-enable one add-in at a time and see when you get the error again. Then check with the developer of that add-in what's causing the problem.