Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program always crash, and even when it works, the answer is wrong. I need to write a simple code using both Excel VBA and

image text in transcribed

The program always crash, and even when it works, the answer is wrong.

I need to write a simple code using both Excel VBA and Excel Formula for solving quadratic equation: ax? + bx + c = 0 with answer display as below: Quadratic Equation Solver Coefficients Values Excel Formula Approach Solution 1 Solution 2 VBA Approach Discriminant Value D Solution 1 Solution 2 I need help from VBA approach and I write the code below but didn't work. Private Sub Worksheet Change(ByVal Target As Range) If Target. Address = Range("CoefficientA"). Address Or Target. Address = Range("CoefficientB"). Address Or Target. Address = Range("Coefficient"). Address Then End If Dim A As Double, B As Double. C As Double. D As Double A = Range("CoefficientA").Value B = Range("CoefficientB").Value C = Range("CoefficientC").Value ID > 0 Then Range("Solution l").Value = (-B + Math.Sqr(D) / (2. A) Range("Solution2").Value = (-B . Math. Sqr(D) / ( 2 A ) ElseIf D = 0 Then Range("Solutionl").Value = (-B + Math.Sqr(D) / (2. A) Range("Solution2").Value = "Same as solution 1 Else Range("Solutionl").Value = "No solution" Range("Solution2").Value = "No solution" End If

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions