Question

Excel to VBA Write a program that will add 2 numbers input by the user and...

Excel to VBA

Write a program that will add 2 numbers input by the user and display the result in a spreadsheet. Use an input box and Val () function to convert the user input to a numerical data type.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

===========================================================================================

Private Sub CommandButton1_Click()

Dim num_one As Double
Dim num_two As Double

num_one = Val(InputBox("Enter the first number: "))
num_two = Val(InputBox("Enter the second number: "))

Worksheets("Sheet1").Activate
Worksheets("Sheet1").Range("B5").Value = num_one + num_two

End Sub
=============================================================================================

Add a comment
Know the answer?
Add Answer to:
Excel to VBA Write a program that will add 2 numbers input by the user and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT