fonctions personnalisées provoquent une erreur #NOM?

%3CLINGO-SUB%20id%3D%22lingo-sub-2252255%22%20slang%3D%22fr-FR%22%3Ecustom%20functions%20cause%20a%20%23NOM%20error%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252255%22%20slang%3D%22fr-FR%22%3E%3CP%3EHello%2C%20my%20custom%20functions%20cause%20a%20%23NOM%20error%3F%20in%20the%20cell.%3C%2FP%3E%3CP%3EMy%20duties%20give%20a%20correct%20result%20when%20calling%20from%20a%20SUB%20in%20VBA.%3C%2FP%3E%3CP%3EMy%20functions%20do%20not%20appear%20in%20the%20Excel%20feature%20list%2C%20nor%20in%20the%20suggestions%20(autocomplete)%20when%20entering.%3C%2FP%3E%3CP%3EI%20tried%20the%20security%20setting%2C%20the%20use%20of%20an%20alias%20by%20the%20name%20manager%20(example%20of%20LAMBDA%20functions).%3C%2FP%3E%3CP%3ENo%20%22Personalized%22%20section%20in%20the%20Functions%20Dialog%20box%20accessible%20from%20the%20Spreadsheet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2252255%22%20slang%3D%22fr-FR%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252322%22%20slang%3D%22en-US%22%3ERe%3A%20fonctions%20personnalis%C3%A9es%20provoquent%20une%20erreur%20%23NOM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252322%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1016219%22%20target%3D%22_blank%22%3E%40Jeanga%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22VIiyi%22%3E%3CSPAN%20class%3D%22JLqJ4b%20ChMk0b%22%3E%3CSPAN%3EMaybe%20I'm%20not%20the%20most%20appropriate%20to%20give%20you%20a%20suggested%20solution%2C%20but%20...%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EWith%20your%20permission%2C%20if%20I%20can%20recommend%20you%2C%20explain%20your%20problem%20in%20detail.%20So%20you%20can%20get%20a%20solution%20proposal%20to%20your%20problem%20much%20faster.%3C%2FP%3E%3CP%3EAt%20the%20same%20time%2C%20it%20is%20much%20easier%20for%20someone%20who%20wants%20to%20help%20to%20understand%20the%20subject.%3C%2FP%3E%3CP%3EA%20win-win%20situation%20for%20everyone.%3C%2FP%3E%3CP%3EIt%20is%20also%20helpful%20to%20know%20the%20operating%20system%20and%20Excel%20version%2C%20as%20different%20approaches%20may%20be%20required%20depending%20on%20the%20Office%20version%20and%20OS.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252334%22%20slang%3D%22fr-FR%22%3ERe%3A%20Custom%20functions%20cause%20a%20%23NOM%20error%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252334%22%20slang%3D%22fr-FR%22%3EWell%2C%20how%20to%20say%20it%20in%20another%20way%3F%3CBR%20%2F%3EI%20create%20a%20function%20in%20VBA%2C%20I%20use%20it%20by%20its%20name%20in%20a%20cell%2C%20Excel%20reply%20%23NAME%3F%3CBR%20%2F%3EExcel%202019%2FW10%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252417%22%20slang%3D%22en-US%22%3ERe%3A%20fonctions%20personnalis%C3%A9es%20provoquent%20une%20erreur%20%23NOM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252417%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1016219%22%20target%3D%22_blank%22%3E%40Jeanga%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20the%20function%20in%20a%20standard%20module%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMB17_0-1617475393516.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F269336i991EEDAF58ABF4FC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JMB17_0-1617475393516.png%22%20alt%3D%22JMB17_0-1617475393516.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252424%22%20slang%3D%22en-US%22%3ERe%3A%20fonctions%20personnalis%C3%A9es%20provoquent%20une%20erreur%20%23NOM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252424%22%20slang%3D%22en-US%22%3EIt%20is%20not%20a%20SUB%20that%20is%20needed.%20You%20need%20to%20declare%20the%20procedure%20with%20FUNCTION%20and%20return%20the%20result%20using%20the%20function%20name.%3C%2FLINGO-BODY%3E
Occasional Contributor

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 dans la liste des fonctions Excel, ni dans les suggestions (autocomplete) lors de la saisie.

J'ai essayé le paramétrage de sécurité, l'utilisation d'un alias par le gestionnaire de nom (exemple des fonctions LAMBDA).

Pas de rubrique "Personnalisées" dans la Boite de dialogue Fonctions accessible depuis la Feuille de calcul.

9 Replies

@Jeanga 

Maybe I'm not the most appropriate to give you a suggested solution, but ...

With your permission, if I can recommend you, explain your problem in detail. So you can get a solution proposal to your problem much faster.

At the same time, it is much easier for someone who wants to help to understand the subject.

A win-win situation for everyone.

It is also helpful to know the operating system and Excel version, as different approaches may be required depending on the Office version and OS.

 

Thank you for your understanding and patience

 

Nikolino

I know I don't know anything (Socrates)

Well, how to say it in another way ?
I create a function in VBA, I use it by its name in a cell, Excel reply #NAME?
Excel 2019/W10

@Jeanga 

 

Is the function in a standard module?

 

JMB17_0-1617475393516.png

 

It is not a SUB that is needed. You need to declare the procedure with FUNCTION and return the result using the function name.
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 ?
Sorry, 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?
don'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

@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

@Jeanga 

Thank you for the update, though  I have never had to use a Class module for the purpose of creating a UDF.  I notice an earlier post from @JMB17 that asked whether you were using a standard module.  It appears that he was at least on the right lines.