Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I just need help on how to complete this problem using VBA. please show steps. 2. Complete this problem on Sheet2. The location of an

image text in transcribed
I just need help on how to complete this problem using VBA. please show steps.
2. Complete this problem on Sheet2. The location of an object can be described by its x and y coordinates. Let's say that you want to know the distance between two mountain peaks. The first peak is located at (xl, y) and the second peak is located at (x2, y2) (x2,y2) y2-yl (x1.yl) (0,0) x2-x1 The distance, d, between two points in space can be calculated by using the following equation: Type the values of x1 and y1 into cells B1 and B2. Next type the values of x2 and y2 into cells DI and D2. Then create a macro named calcdist that will accomplish the following tasks: Obtain the values for xl and yl from the worksheet and store them in variables Obtain the values of x2 and y2 from the worksheet and store them in variables Calculate the distance between the two mountain peaks and store this value in a variable Output the distance to cell C5 Create a run button on Sheet2 that will execute the macro calcdist. Before clicking the run button, make sure that you input the values of x1 and yl in cells B1 and B2, and input the values of x2 and y2 into cells DI and D2 To test your code, try typing 2 and 4 into cells Bl and B2, and type 5 and 6 into cells DI and D2. Then click the run button. The distance between the two points is d-V(5-2): + (6-4)2 = V32 + 22-v13-3.606 If the units of xl, yl, x2, and y2 are miles, then the two peaks are about 3.6 miles away from each other

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago