If a variable appears to the left of an equals sign, then its new value in memory becomes whatever is on the right of the equals sign. To assign a value to a variable: unitCost = 1.20 unitsSold = 20 totalCost = unitCost * unitsSold totalCost = totalCost + 20 TeamName = “Tigers” Input Boxes and Message Boxes Two VBA built-in functions: InputBox(prompt to user in quotes, title in quotes) (the title is optional) The following creates an input box called price” “Selling that asks the user to the product’s unit price.” The “Enter value is stored in the variable called “price”. price = InputBox(“Enter the product’s unit price.”, price”) “Selling MsgBox(statement in quotes, button, title in quotes) (the button indicator and title are optional) The following creates a message box called price” “Selling that states the price and includes an button. “information” MsgBox product’s unit price is $2.40.”, vbInformation, price” “The “Selling
If a variable appears to the left of an equals sign, then its new value in memory becomes whatever is on the right of the equals sign. To assign a value to a variable: unitCost = 1.20 unitsSold = 20 totalCost = unitCost * unitsSold totalCost = totalCost + 20 TeamName = “Tigers” Input Boxes and Message Boxes Two VBA built-in functions: InputBox(prompt to user in quotes, title in quotes) (the title is optional) The following creates an input box called “Selling price” that asks the user to “Enter the product’s unit price.” The value is stored in the variable called “price”. price = InputBox(“Enter the product’s unit price.”, “Selling price”) MsgBox(statement in quotes, button, title in quotes) (the button indicator and title are optional) The following creates a message box called “Selling price” that states the price and includes an “information” button. MsgBox “The product’s unit price is $2.40.”, vbInformation, “Selling price”
MgtOp-556-Topic-1-Set-1.docx