Ok I kind of found what caused the overflow: The Intger format cant handle the numbers I needed "396054" to "500000" so I changed the format for "Anzahl" and "Zahl" to Long.

Now everytime I start the function my laptop goes nuts
I somehow created a never ending loop. I still dont know what to do. Does someboda have a idea to solve my prob.

Thank you