I'm looking to write a code in vba that takes 4 given numbers and uses mathematical operations on them (add,sub,mult,division,power,factorial) and then lists the results. Any of the operations can be used but all 4 numbers must be used each time.

Any help would be greatly appreciated. Thx

Adding 4 numbers and multiplying 4 numbers makes sense: A+B+C+D, A*B*C*D, but subtraction and exponents can only operated on 2 numbers at a time. Factorial can only operate on 1 number as a time. I think you need to define your problem a little better to get a clearer vision of your solution. Maybe include examples of your input and expected output as well as what you have tried already.

Your title suggests you are doing this in VBA, which always runs inside another application, like Word or Excel. What is the hosting application for this code? That will help make understanding easier of how you interface with the application for potential input and output.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.