Results 1 to 3 of 3

Return a single message box within a loop.

Threaded View

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    1

    Return a single message box within a loop.

    Hi! I need to be make a multiplication table from a user input variable. I am using a for loop and have that part down; however, I need the multiplication table to be output in only one message box. This is the code I have so far....

    Sub Multiplication_table()
    Dim x As Integer
    Dim answer As Double
    
    x = InputBox("Please enter an integer to be used in a multiplication table.")
    
        For i = 1 To 10
        answer = x * i
        MsgBox ("" & x & " * " & i & " = " & answer)
        Next i
    End Sub
    Could someone please shed some light on how to stop from looping a new message box each time and only return one involving the entire table?
    For example I need to return
    1*2=2
    2*2=4
    3*2=6
    4*2=8
    5*2=10
    6*2=12
    ...and so on for x=2 THANKS
    Last edited by jeffreybrown; 10-19-2012 at 08:39 PM. Reason: Added code tags for new user...Please do so next time...Thanks.

Thread Information

Users Browsing this Thread

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

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