This is to allow an excel user to be able to run a program that you have created. Simple Problem Example: In this image, all three figures have the same perimeter and we have a square, an equilateral triangle, and a rectangle. Calculate the height of the rectangle based on the area of the square. Of course, this problem can be solved simply with formulas. But here we're going to assume that the solution is written in python: def trouver_hauteur(aire): # Calculer la longueur du côté du carré (côté = racine carrée de l'aire) cote_carre = aire ** 0.5 # Calculer le périmètre du carré perimetre_carre = 4 * cote_carre # Calculer la longueur du côté du triangle équilatéral cote_triangle = perimetre_carre / 3 # Calculer la hauteur du rectangle hauteur_rectangle = (perimetre_carre - 2 * cote_triangle) / 2 return hauteur_rectangle # Exemple d'utilisation aire_du_carre = 81 hauteur_resultante = trouver_hauteur(aire_du_carre) print("hauteur rectangle "+str(hauteur_resultante)) The purpose of this tool is helping an excel user to run this code on his worksheet: You only have to use this simple code: Sub lance_script() Run "'python.xlsm'!lance_script_python" End Sub It's also possible to use the form to run the script without having to write any macro.
|