+ Reply to Thread
Results 1 to 6 of 6

I need with Macro to Add two Numbers using Input forms

  1. #1
    Registered User
    Join Date
    05-04-2015
    Location
    Zambia
    MS-Off Ver
    2013
    Posts
    8

    I need with Macro to Add two Numbers using Input forms

    I need help with a Macro to:
    • Allows a user to enter 2 numbers using data input forms (the 2 values are save on the spreadsheet)
    • Then adds the two numbers (answer is displayed on the spreadsheet)
    • Then asks if the user would like to enter more numbers to be calculated
    o If a user agree then allows the user to enter 2 more numbers for the calculation to take place
    o Otherwise exit Macro.

    Thank you

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: I need with Macro to Add two Numbers using Input forms

    What part of this do you need help with?

  3. #3
    Registered User
    Join Date
    05-04-2015
    Location
    Zambia
    MS-Off Ver
    2013
    Posts
    8

    Re: I need with Macro to Add two Numbers using Input forms

    I have the code below which I want to add or use MsgBoxes instead of inputBoxes...
    Sub kim15m()
    Range("C1").Formula = "=A1+B1"
    answer = "yes"
    While answer = "yes"
    Range("A1").Value = Application.InputBox(Prompt:="Enter first value ", Type:=1)
    Range("B1").Value = Application.InputBox(Prompt:="Enter second value ", Type:=1)
    answer = Application.InputBox(Prompt:="Do you want to do this again??", Type:=2)
    Wend
    End Sub

  4. #4
    Registered User
    Join Date
    05-04-2015
    Location
    Zambia
    MS-Off Ver
    2013
    Posts
    8

    Re: I need with Macro to Add two Numbers using Input forms

    Quote Originally Posted by davesexcel View Post
    What part of this do you need help with?
    I have the code below which I want to add or use MsgBoxes instead of inputBoxes...
    I NEED TO PUT MSGBOXES FIRST ASK USER TO ENTER FIRST NUMBER
    THEN LATER ASKING USER IF HE WANT TO ADD TWO MORE NUMBERS, IF USER SAYS YES, Macro should Add the new numbers, answer saved in worksheet, say D1
    I will appreciate any help...
    Code is...
    Sub kim15m()
    Range("C1").Formula = "=A1+B1"
    answer = "yes"
    While answer = "yes"
    Range("A1").Value = Application.InputBox(Prompt:="Enter first value ", Type:=1)
    Range("B1").Value = Application.InputBox(Prompt:="Enter second value ", Type:=1)
    answer = Application.InputBox(Prompt:="Do you want to do this again??", Type:=2)
    Wend
    End Sub

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: I need with Macro to Add two Numbers using Input forms

    This is an edited code from the VBA help file.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-04-2015
    Location
    Zambia
    MS-Off Ver
    2013
    Posts
    8

    Re: I need with Macro to Add two Numbers using Input forms

    @davesexce
    Thank you VB Help team this is exactly how I wanted it to work.
    I really appreciate it
    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. I need a Macro to Add two numbers with excel input form
    By kim15m in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-08-2015, 04:41 AM
  2. Data Input using VBA excel forms
    By Darrel1986 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-16-2014, 03:19 PM
  3. Input Data using Forms
    By cneff in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-09-2011, 01:42 AM
  4. Input Forms
    By LAB2007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2007, 05:16 AM
  5. [SOLVED] Macro for user to input 10 numbers
    By Deedee in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 10-21-2005, 03:05 PM

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