Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I cannot get this VBA code to work. Review the Commission macro that begins in cell A1 of the VBA worksheet. There is an error

I cannot get this VBA code to work.

Review the Commission macro that begins in cell A1 of the VBA worksheet. There is an error in the macro, and it will not run. Copy the macro to a new module in the Visual Basic Editor and correct the macro. Insert a comment on the line below Sub Commission() that reads 'Creates two variables, Goal and X (do not include a period after this and all comments). Insert a second comment above the line of code that builds the InputBox that reads 'Opens an input box and saves the result as Goal (do not include a period after this and all comments).

Insert a third comment below the line of code that builds the InputBox that reads 'Multiplies the Goal times the Total Sales range, saves the result in the variable X Insert a fourth comment below the line of code that you have corrected. The fourth comment defines the X variable that reads 'Returns the variables to the payout range on the spreadsheet Paste the corrected macro back to cell A1 on the VBA worksheet. Do not include any blank lines in the pasted code.

This is the code in my sheet that needs corrected

Sub Commission()
Dim Goal As Single
Dim X As Currency
Goal = InputBox("Please Input Commission Percentage as decimal. Ex. 15% should be input as .15.", "Commission")
X = Goal * Range("Total_Sales")
Range("Payout").Formula = X

End Sub

Below is my correction that will not work

Sub Commission()
'Creates two variables, Goal and X
Dim Goal As Single
Dim X As Currency
'Opens an input box and saves the result as Goal
Goal = InputBox("Please Input Commission Percentage as decimal. Ex. 15% should be input as .15.", "Commission")
'Multiples the Goal times the Total Sales range, saves the result in the variable X
X = Goal * Range("Total_Sales")
'Returns the variablkes to the payout range on the spreadsheet
Range("Payout").Formula = X
End Sub

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_2

Step: 3

blur-text-image_3

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

Corporate Valuation A Guide For Managers And Investors

Authors: Phillip R. Daves, Michael C. Ehrhardt, Ron E. Shrieves

1st Edition

0324274289, 978-0324274288

More Books

Students also viewed these Finance questions