Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing VBA code VBA is going to tell the users fortune! VBA will ask the user to think of a number between 1

Need help writing VBA code

VBA is going to tell the users fortune! VBA will ask the user to think of a number between 1 and 9. The user will then see a series of message boxes with the following instructions:

  • Multiply their number by three.

  • Add three to the result.

  • Multiply the whole thing by three.

  • Add the digits of their final number together.

    VBA will read their minds as they look at their fortune on the spreadsheet and highlight the message corresponding to their final number even though the program never asked what number they originally picked!

    Here are some specific instructions about how I want you to do the above problem. Read all these instructions carefully. A flowchart is on the next page.

  1. Use the FortuneTelling.xlsx workbook to complete this problem, put your code in a module. Save your work often! And dont forget to save it as an .xlsm, the file you get with the assignment is a .xlsx.

  2. Use all the conventions we have used in class.

  3. Use four variables to hold the four instruction bullets above (one variable per instruction.)

  4. Use five message boxes. One to give the user the original instruction about thinking of a

    number between 1 and 9, and one using each of the four message variables from instruction 3.

  5. Save your work often!

  6. Nine will be their final answer. If the user correctly follows the instructions, their result will be

    9, no matter the original number chosen. Dont believe me? Try it! Show the user their fortune by highlighting cell B10. This isnt something weve done before, so here is a hint. To fill in a background color to a cell use the following on a range object: .Interior.ColorIndex = 26. (26 is a bright pink color, if you want to use a different color experiment with a different number!)

  7. Note, you do not need to ask the user for the number they are choosing or do any calculations. Only do the things you are being asked to do in these instructions. If you ask them for their original number, you arent reading their mind!

  8. Submit your workbook to Canvas by the due date, which you can see on the assignment in Canvas. Canvas will block you from submitting work even one second after the assignment closes. Do not be late!

  9. This is an individual, not a group assignment.

  10. Save your work often!

  11. If you have a question about an instruction, ask me via Teams chat.

  12. Dont overcomplicate this. It is meant to be a straightforward set of instructions. I am not

    trying to trick you. Just follow the instructions and you will be fine. If it isnt mentioned on this page, I dont care about it. You dont need to ask if you should do xyz. If its mentioned here you should, if it isnt, you shouldnt.

Flowchart: Start magic procedure=> define 4 variables => Assign value to variables => Five message boxes => Highlight cell B10=> End magic procedure

1 You will own a purple cow.
2 You will get married 25 times.
3 You will be a world famous harmonica player.
4 You will star in a reality show about cheese farmers.
5 You will win Iceland in a high stakes poker game.
6 You will eat nothing but bologna from the ages of 66 to 68.
7 You will be a passenger on the first Mars colonization effort.
8 You will discover a deep sea snail which will be named after you.
9 You will pass this assignment.

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 In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago