On Error GoTo only works once

bradywadywoo

New Member
Joined
May 2, 2011
Messages
1
Hello i have come accross a problem i used on error goto line 1 which shows a error message i will show the code please help if you answer just remember im quiet new to visual basics and will need a bit of explaining:

Module Module1
Code:
    Sub Main()
1:      Console.Clear()
        Console.Write("Simple Caclulator")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("1. All Calculation will be answered in Integer mode")
        Console.WriteLine()
        Console.Write("2. All Calculations wil be answered in Decimal mode")
        Console.WriteLine()
        Console.Write("3. Exit")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write(" Please enter and option:")
        Dim Uoption As String
        Uoption = Console.ReadLine
        If IsNumeric(Uoption) = False Then
4:          Console.Clear()
            Console.Write("Please select a valid option.")
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            GoTo 1
        End If
        If Uoption = 1 Then
            GoTo 2
        End If
        If Uoption = 2 Then
            GoTo 3
        End If
        If Uoption = 3 Then
            End
        End If

2:      Console.Clear()
        Console.Write("Simple Calculator: Integer Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("1.Addition")
        Console.WriteLine()
        Console.Write("2.Subtraction")
        Console.WriteLine()
        Console.Write("3.Division")
        Console.WriteLine()
        Console.Write("4.Multiplication")
        Console.WriteLine()
        Console.Write("5.Exit")
        Console.WriteLine()
        Console.Write("6.Change Calculator Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("Please enter and option:")
        Dim Uchoice As Integer
        On Error GoTo 4
        Uchoice = CInt(Console.ReadLine)
        If IsNumeric(Uchoice) = False Then
            Console.Clear()
            Console.Write("Please select a valid option.")
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            GoTo 1
        End If
        If Uchoice = 1 Then
            On Error GoTo 4
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Addition")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Integer
            value1 = CInt(Console.ReadLine)
            Console.Write("What would you like to add to {0}?  {0} + ", value1)
            Dim value2 As Integer
            value2 = CInt(Console.ReadLine)
            Dim answer As Integer
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} + {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If
        On Error GoTo 4
        If Uchoice = 2 Then
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Subtraction")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Integer
            value1 = CInt(Console.ReadLine)
            Console.Write("What would you like to subtract {0} by?  {0} - ", value1)
            Dim value2 As Integer
            value2 = CInt(Console.ReadLine)
            Dim answer As Integer
            answer = value1 - value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} - {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If
        On Error GoTo 4
        If Uchoice = 3 Then
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Division")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Integer
            value1 = CInt(Console.ReadLine)
            Console.Write("What would you like to divide {0} by?  {0} / ", value1)
            Dim value2 As Integer
            value2 = CInt(Console.ReadLine)
            Dim answer As Integer
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} / {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1

        End If
        On Error GoTo 4
        If Uchoice = 4 Then
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Multiplication")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Integer
            value1 = CInt(Console.ReadLine)
            Console.Write("What would you like to multiply {0} by?  {0} * ", value1)
            Dim value2 As Integer
            value2 = CInt(Console.ReadLine)
            Dim answer As Integer
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} * {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If
3:      Console.Clear()
        Console.Write("Simple Calculator: Integer Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("1.Addition")
        Console.WriteLine()
        Console.Write("2.Subtraction")
        Console.WriteLine()
        Console.Write("3.Division")
        Console.WriteLine()
        Console.Write("4.Multiplication")
        Console.WriteLine()
        Console.Write("5.Exit")
        Console.WriteLine()
        Console.Write("6.Change Calculator Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write("Please enter and option:")
        Uchoice = CDec(Console.ReadLine)
        On Error GoTo 4
        If IsNumeric(Uchoice) = False Then
            Console.Clear()
            Console.Write("Please select a valid option.")
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            GoTo 1
        End If
        If Uchoice = 1 Then
            On Error GoTo 4
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Addition")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Decimal
            value1 = CDec(Console.ReadLine)
            Console.Write("What would you like to add to {0}?  {0} + ", value1)
            Dim value2 As Decimal
            value2 = CDec(Console.ReadLine)
            Dim answer As Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} + {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If
        If Uchoice = 2 Then
            On Error GoTo 4
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Subtraction")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Decimal
            value1 = CDec(Console.ReadLine)
            Console.Write("What would you like to subtract {0} by?  {0} - ", value1)
            Dim value2 As Decimal
            value2 = CDec(Console.ReadLine)
            Dim answer As Decimal
            answer = value1 - value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} - {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If
        If Uchoice = 3 Then
            On Error GoTo 4
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Division")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Decimal
            value1 = CDec(Console.ReadLine)
            Console.Write("What would you like to divide {0} by?  {0} / ", value1)
            Dim value2 As Decimal
            value2 = CDec(Console.ReadLine)
            Dim answer As Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} / {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1

        End If
        If Uchoice = 4 Then
            On Error GoTo 4
            Console.Clear()
            Console.Write("Simple Calculator: Integer mode: Multiplication")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please Enter your first value:")
            Dim value1 As Decimal
            value1 = CDec(Console.ReadLine)
            Console.Write("What would you like to multiply {0} by?  {0} * ", value1)
            Dim value2 As Decimal
            value2 = CDec(Console.ReadLine)
            Dim answer As Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} * {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            GoTo 1
        End If

    End Sub

End Module



PLEASE HELP ASAP

THANKS SO MUCH

Brad,
 
Last edited by a moderator:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi bradywadypoo,

_ 1 ) Just like in VBA, in VB the
On Error Go To 4
Bit in your code needs to be done just the once before you need it, not several times after each possible error occurrence!


_2) And the same also as in VBA, if you want it to be used more than once, then you need a
On Error GoTo -1
At the appropriate point!


See:
On Error WTF? | Excel Matters
https://app.box.com/files/0/f/3664136577/1/f_29651830467



_ I did this modified code and checked it in the Console Running Bit in VB 2008. Seems to work and do what you want




Code:
[color=darkgreen]'[/color]
'
'
'http://www.mrexcel.com/forum/general-excel-discussion-other-questions/547261-error-goto-only-works-once.html
Module Module1

    [color=blue]Sub[/color] Main()

        [color=blue]On[/color] [color=blue]Error[/color] [color=blue]GoTo[/color] 4 [color=darkgreen]'Error Handler for whole Sub[/color]
1:      Console.Clear()
        Console.Write ("Simple Caclulator")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("1. All Calculation will be answered in Integer mode")
        Console.WriteLine()
        Console.Write ("2. All Calculations wil be answered in Decimal mode")
        Console.WriteLine()
        Console.Write ("3. Exit")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write (" Please enter and option:")
        [color=blue]Dim[/color] Uoption [color=blue]As[/color] [color=blue]String[/color]
        Uoption = Console.ReadLine
        [color=blue]If[/color] IsNumeric(Uoption) = [color=blue]False[/color] [color=blue]Then[/color]
4:          Console.Clear()
            Console.Write ("Please select a valid option.")
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            [color=blue]On[/color] [color=blue]Error[/color] [color=blue]GoTo[/color] -1
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]


        [color=blue]If[/color] Uoption = 1 [color=blue]Then[/color]
            [color=blue]GoTo[/color] 2
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uoption = 2 [color=blue]Then[/color]
            [color=blue]GoTo[/color] 3
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uoption = 3 [color=blue]Then[/color]
            [color=blue]End[/color]
        [color=blue]End[/color] [color=blue]If[/color]

2:      Console.Clear()
        Console.Write ("Simple Calculator: Integer Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("1.Addition")
        Console.WriteLine()
        Console.Write ("2.Subtraction")
        Console.WriteLine()
        Console.Write ("3.Division")
        Console.WriteLine()
        Console.Write ("4.Multiplication")
        Console.WriteLine()
        Console.Write ("5.Exit")
        Console.WriteLine()
        Console.Write ("6.Change Calculator Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("Please enter and option:")
        [color=blue]Dim[/color] Uchoice [color=blue]As[/color] [color=blue]Integer[/color]
        [color=darkgreen]'On Error GoTo 4[/color]
        Uchoice = [color=blue]CInt[/color](Console.ReadLine)
        [color=blue]If[/color] IsNumeric(Uchoice) = [color=blue]False[/color] [color=blue]Then[/color] [color=blue]GoTo[/color] 4
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uchoice = 1 [color=blue]Then[/color]
            [color=darkgreen]'On Error GoTo 4[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Addition")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] [color=blue]Integer[/color]
            value1 = [color=blue]CInt[/color](Console.ReadLine)
            Console.Write("What would you like to add to {0}? {0} + ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] [color=blue]Integer[/color]
            value2 = [color=blue]CInt[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] [color=blue]Integer[/color]
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} + {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]
        [color=darkgreen]'On Error GoTo 4[/color]
        [color=blue]If[/color] Uchoice = 2 [color=blue]Then[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Subtraction")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] [color=blue]Integer[/color]
            value1 = [color=blue]CInt[/color](Console.ReadLine)
            Console.Write("What would you like to subtract {0} by? {0} - ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] [color=blue]Integer[/color]
            value2 = [color=blue]CInt[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] [color=blue]Integer[/color]
            answer = value1 - value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} - {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]
        [color=darkgreen]'On Error GoTo 4[/color]
        [color=blue]If[/color] Uchoice = 3 [color=blue]Then[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Division")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] [color=blue]Integer[/color]
            value1 = [color=blue]CInt[/color](Console.ReadLine)
            Console.Write("What would you like to divide {0} by? {0} / ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] [color=blue]Integer[/color]
            value2 = [color=blue]CInt[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] [color=blue]Integer[/color]
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} / {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1

        [color=blue]End[/color] [color=blue]If[/color]
        [color=darkgreen]'On Error GoTo 4[/color]
        [color=blue]If[/color] Uchoice = 4 [color=blue]Then[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Multiplication")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] [color=blue]Integer[/color]
            value1 = [color=blue]CInt[/color](Console.ReadLine)
            Console.Write("What would you like to multiply {0} by? {0} * ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] [color=blue]Integer[/color]
            value2 = [color=blue]CInt[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] [color=blue]Integer[/color]
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} * {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]
3:      Console.Clear()
        Console.Write ("Simple Calculator: Integer Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("Please Select and option from the menu below by typing the corresponding number and pressing enter")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("1.Addition")
        Console.WriteLine()
        Console.Write ("2.Subtraction")
        Console.WriteLine()
        Console.Write ("3.Division")
        Console.WriteLine()
        Console.Write ("4.Multiplication")
        Console.WriteLine()
        Console.Write ("5.Exit")
        Console.WriteLine()
        Console.Write ("6.Change Calculator Mode")
        Console.WriteLine()
        Console.WriteLine()
        Console.Write ("Please enter and option:")
        Uchoice = [color=blue]CDec[/color](Console.ReadLine)
        [color=darkgreen]'On Error GoTo 4[/color]
        [color=blue]If[/color] IsNumeric(Uchoice) = [color=blue]False[/color] [color=blue]Then[/color] [color=blue]GoTo[/color] 4
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uchoice = 1 [color=blue]Then[/color]
            [color=darkgreen]'On Error GoTo 4[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Addition")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] Decimal
            value1 = [color=blue]CDec[/color](Console.ReadLine)
            Console.Write("What would you like to add to {0}? {0} + ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] Decimal
            value2 = [color=blue]CDec[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} + {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uchoice = 2 [color=blue]Then[/color]
            [color=darkgreen]'On Error GoTo 4[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Subtraction")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] Decimal
            value1 = [color=blue]CDec[/color](Console.ReadLine)
            Console.Write("What would you like to subtract {0} by? {0} - ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] Decimal
            value2 = [color=blue]CDec[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] Decimal
            answer = value1 - value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} - {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uchoice = 3 [color=blue]Then[/color]
            [color=darkgreen]'On Error GoTo 4[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Division")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] Decimal
            value1 = [color=blue]CDec[/color](Console.ReadLine)
            Console.Write("What would you like to divide {0} by? {0} / ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] Decimal
            value2 = [color=blue]CDec[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} / {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1

        [color=blue]End[/color] [color=blue]If[/color]
        [color=blue]If[/color] Uchoice = 4 [color=blue]Then[/color]
            [color=darkgreen]'On Error GoTo 4[/color]
            Console.Clear()
            Console.Write ("Simple Calculator: Integer mode: Multiplication")
            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please Enter your first value:")
            [color=blue]Dim[/color] value1 [color=blue]As[/color] Decimal
            value1 = [color=blue]CDec[/color](Console.ReadLine)
            Console.Write("What would you like to multiply {0} by? {0} * ", value1)
            [color=blue]Dim[/color] value2 [color=blue]As[/color] Decimal
            value2 = [color=blue]CDec[/color](Console.ReadLine)
            [color=blue]Dim[/color] answer [color=blue]As[/color] Decimal
            answer = value1 + value2
            Console.WriteLine()
            Console.WriteLine()
            Console.Write("{0} * {1} = {2}", value1, value2, answer)
            Console.WriteLine()
            Console.WriteLine()
            Console.Write ("Please press enter to go back to the main menu.")
            Console.ReadLine()
            Console.Clear()
            [color=blue]GoTo[/color] 1
        [color=blue]End[/color] [color=blue]If[/color]

    [color=blue]End[/color] [color=blue]Sub[/color]

End Module


Alan.
Germany
 
Upvote 0
I'd be surprised if he's still waiting for an answer to be honest...

Just hit it coincidentally while searching for and trying to remember me Error stuff. Seemed a good thing to warm up on.

I confesse i was curious myself why i answered a Visual Basic thing which i know even less about than VBA...:confused:
_ maybe........

Someone famous in the world said
“Because it is there”

Someone famous in this forum said
“Because he ( meaning me ) can “

Someone asked me once why i was counting things. ( I was counting things at the time and confess i did not know why... ) I said:
“Someone’s got to do it”

Not sure if that helps...
Alan.DE

P.s.
Maybe....
Predictability is the hobgoblin of small minds. ;)

Or On A serious note....The title could lead someone here on a Google search or wotever who could benefit from the Links i gave
;)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,565
Messages
6,173,092
Members
452,501
Latest member
musallam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top