Results 1 to 11 of 11

Input box to sum and display sum as msgbox

Threaded View

  1. #1
    Registered User
    Join Date
    02-06-2019
    Location
    Colorado
    MS-Off Ver
    2016
    Posts
    8

    Input box to sum and display sum as msgbox

    Hello I am struggling to make this assignment happen:Create a macro procedure that asks for three integers (one at a time) and displays their sum in a message box.
    Insert a module into the project, then insert a macro procedure named AddThreeNumbers. Code this procedure so that when it is executed, it will ask for three integers (one at a time), store them into three variables respectively, computes their sum, and display “The sum of [1st num], [2nd Num], and [3rd Num] is [the sum of the three numbers].” where each square bracket should be replaced by the numbers that the user put in. That is, if the user put in 10, 20, and 30 into the three boxes, it should display “The sum of 10, 20, and 30 is 60.” Make sure you declare and use appropriate variables.
    1. The message box should have the title, “My Own Adder”.
    2. Insert an ActiveX Command button displaying a picture of your choice, with the caption, “I Add Three Integers.”
    3. Link the AddThreeNumbers procedure to the button so that when the button is clicked, the procedure is executed.
    4. Save and submit the workbook.
    I currently have this code but my input boxes are not being saved as a variable.

    Private Sub CommandButton1_Click()
    Dim myValue As Integer
    myValue = inputbox("Enter first interger")
    Dim myValue2 As Integer
    myValue2 = inputbox("Enter second interger")
    Dim myValue3 As Integer
    myValue3 = inputbox("Enter thrid interger")
    MsgBox ("The sum of" & myValue ", " & myValue2 ", " & myValue3 "Is SUM(myValue, myValue2, myValue3)")
    End Sub
    Now I am getting an error message in my msgbox code when I add the Sum function. Addtionally, I still get the words "myValue..." in the message box not the numbers entered into the inputbox.
    Last edited by alexWhit21; 02-06-2019 at 07:07 PM. Reason: Updated code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Multiple MSGBOX with manual input
    By xatomicx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-27-2014, 06:44 PM
  2. Msgbox to input to last row problem with hidden rows
    By Donnerblue in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-12-2011, 01:48 AM
  3. Msgbox if you input a value smaller than another
    By tsioumiou in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-03-2010, 02:54 PM
  4. Date Code for input into MsgBox
    By Jessy01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2009, 05:01 PM
  5. Pop MsgBox if cell input not a certain format
    By munkayboi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2007, 02:21 AM
  6. [SOLVED] Input Title on MsgBox
    By pkeegs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2006, 06:20 PM
  7. MsgBox Display
    By Michael S. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2005, 06:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1