Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90317

GoTo is not defined - in VBA

$
0
0

When I on the step F8 click. then say it Goto is not defined. I try to make a inputbox with a messagebox that me the answer give. And I try also to make code when the values not correct is. See, you where I make a mistake in my VBA code:

Sub TwoNumbersinputbox()

Dim bytAnswer1 As String
Dim bytAntwer2 As String
Dim Range As Byte
Dim strNumber1 As String
Dim strNumber2 As String
[C3] = "Number1"
[C4] = "Number2"

Start1:
strNumber1 = InputBox("Give number one?", "Invoer", 5, 567, 567)
   If IsNumeric(strNumber1) Then
   MsgBox "This must be Number1", vbCritical, _
   "Number1 input"
   GoTo strNumber1
   Else: [B2] = strNumber1
   End If

  If Not IsNumeric(strNumber1) Then
  MsgBox "there is error.", vbCritical, "Number2 input"
  bytAnwer1 = MsgBox("Start Again?", vbYesNo)
  If bytAnwer1 = vbYes Then GoTo Start
  End If

Start2:
strGetal2 = InputBox("Give Number2?", "Input", 5, 567, 567)
   If IsNumeric(strNumber2) Then
   MsgBox "This must be Number2 ", vbCritical, _
   "Number2 input"
   GoTo strNumber2
   Else: [B3] = strNumber2
 End If

  If Not IsNumeric(strGetal2) Then
  MsgBox "Is there an error.", vbCritical, "Number2 input"
  bytAnswer2 = MsgBox("Start Again?", vbYesNo)
  If bytAnswer2 = vbYes Then GoTo Start
  End If

End Sub

Viewing all articles
Browse latest Browse all 90317

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>