Forum Discussion
Jeanga
Apr 03, 2021Copper Contributor
fonctions personnalisées provoquent une erreur #NOM?
Bonjour, mes fonctions personnalisées provoquent une erreur #NOM? dans la cellule. Mes fonctions donnent un résultat correct lors d'un appel depuis un SUB en VBA. Mes fonctions n'apparaissent pas d...
PeterBartholomew1
Apr 03, 2021Silver Contributor
It is not a SUB that is needed. You need to declare the procedure with FUNCTION and return the result using the function name.
Jeanga
Apr 03, 2021Copper Contributor
sorry if I'm not clear enough.
"I create a FUNCTION in VBA, I use it by its name in a cell, Excel reply #NAME?" (bis)
When I use it in a Sub it works, but of course I create a function.
I use VBA since 1998 in Word and Excel, even it was called with an other name.
I use to program Function, (with Application.Volatile method, I'm not a rookie).
I think I've got here a bad parameters meaning but I can't put the finger on.
Is there a way to have a MICROSOFT technicien online to verify, quickly, the way I can retrieve my complete Excel pleasure ?
"I create a FUNCTION in VBA, I use it by its name in a cell, Excel reply #NAME?" (bis)
When I use it in a Sub it works, but of course I create a function.
I use VBA since 1998 in Word and Excel, even it was called with an other name.
I use to program Function, (with Application.Volatile method, I'm not a rookie).
I think I've got here a bad parameters meaning but I can't put the finger on.
Is there a way to have a MICROSOFT technicien online to verify, quickly, the way I can retrieve my complete Excel pleasure ?
- PeterBartholomew1Apr 03, 2021Silver ContributorSorry, I misread your original post where it mentioned the SUB. Is the problem with a specific function or can't you define UDFs at all?
- JeangaApr 04, 2021Copper Contributordon't be sorry, no issue 🙂
It do the same with every customized functions.
When you write the equal sign (=) in a cell and a letter, Excel propose you a list of functions that begin with this letter. ie =s -> SEC, SECH, SECONDE, and so on.
Mine doesn't appear in this list.
If I bind my function with an alias (like in the LAMBDA example) by the Name Manager, the Alias appear in the list but it still generat a #NAME? error in the cell.
I defined the folder where my Workbook is stored as trust folder in the Excel parameters, it doesn't change anything.
I think the way for me to fix it is in the parameters but I didn't find it.
Sorry to be angry yesterday, for me computers HAVE TO work, and I have no patience for this meanings 😞- JeangaApr 08, 2021Copper Contributor
@everyone
I found the way to use my customized Functions in my Sheet.
Simply declare the functions in a CLASS MODULE, not in the Workbook or Worksheets code modules.
Thanks to those who tried to help me.
If one (or more) of you gave me this trick, please apologize. I didn't understand your meaning.
I don't remember I had to declare my functions in a Class Module before.
Well, it works, I love to code.
Thanks to all 🙂