To concatenate two strings together, use the ampersand (&). The following SUB gets a product’s name and then displays it in a message box: Sub GetProductName() Dim product As String product = InputBox("Enter the product's name.") MsgBox "The product's name is " & product & ".", vbInformation End Sub To insert a carriage return (start on a new line) in a message box, put the following between the first line and the second line: & vbNewLine & Exercise 1 Open a new workbook and save it as Input Output 1.xlsm. Then create a SUB called that does the following: RevenueCalc (1) It asks the user for the unit price of some product and stores it in the variable defined as Double type; (2) it asks unitPrice, the user for the number of items sold and stores it in the variable defined as Long type; (3) it calculates the revenue quantitySold, from this product and stores it in the variable defined as revenue, Double type; and (4) it displays a message such as revenue “The from this product was $380.”
To concatenate two strings together, use the ampersand (&). The following SUB gets a product’s name and then displays it in a message box: Sub GetProductName() Dim product As String product = InputBox("Enter the product's name.") MsgBox "The product's name is " & product & ".", vbInformation End Sub To insert a carriage return (start on a new line) in a message box, put the following between the first line and the second line: & vbNewLine & Exercise 1 Open a new workbook and save it as Input Output 1.xlsm. Then create a SUB called RevenueCalc that does the following: (1) It asks the user for the unit price of some product and stores it in the variable unitPrice, defined as Double type; (2) it asks the user for the number of items sold and stores it in the variable quantitySold, defined as Long type; (3) it calculates the revenue from this product and stores it in the variable revenue, defined as Double type; and (4) it displays a message such as “The revenue from this product was $380.”
MgtOp-556-Topic-1-Set-1.docx