Excel/VBA Function

New Contributor

Hello everyone, I have an issue with a VBA function created which doesn't save along with the excel document ( it is a .xlsm file). When I re-open the excel, in the cell where the formula is, now comes up as an Invalid Name Error. I do need to mention that I have followed all steps suggested by this error. Has anyone faced this problem before? Can I please get a bit of advice.


Many thanks in advance

6 Replies


It would be of great advantage if you insert a file (without sensitive data) so that we can see and understand the problem better. thus you can also be helped faster and more precisely.
So i can only guess and share with you the first thought that goes through my head.


Would conditional formatting help?
If the error doesn't bother somewhere else, you could make it disappear with the conditional formatting (without actually being gone). Now a thought ... preferably a file.

I know that I don't know (Socrates)

@Nikolino Thanks for your reply.

I have attached the .xlsm file I was referring to. The cell where the custom function is E6.


I need to mention that I am not an Excel pro, as you can tell, and all I did was to follow step by step tutorials. I might have missed something along the way.


But I need this formula to work when I re-open the file. 



Make it disappear on the quick with Conditional Formatting.

Have the whole column in the conditional formatting so that all letters are white in the event of an error. Thus not visible to the eye of the beholder.

Enclosed your file.


I would be happy to know if I could help.


If you find this helpful, please mark it as "Best Answer" and as Like (click thumbs up), it will be beneficial to more Community members reading here.



I know I don't know anything (Socrates)

Best Response confirmed by CatalinaDragomir (New Contributor)



It works fine for me. Perhaps double check your macro settings are enabled?


file\options\trust center\trust center settings\macro settings


Also, I noticed the function is in two modules (Sheet1 and Module 1)? Only user defined functions in standard modules can be used in a worksheet formula. I would delete the copy in Sheet1.



Thanks a lot for trying to help me. 


I have looked to the macro setting and enabled them, apparently that was the issue. Now it is working fine. 


Have a great day, and thanks again for your time. 

You're welcome. Have a good day!