me again , i am getting an issue with VBA resume function, my cobe below to check the number if it is primary number, it work fine for checking primary number , but when i put additonal code to try with another number , i got the issue (see the photo attach).
this is my code:
Sub check_pri()
Dim flag As Boolean
Dim i As Long: i = 2
Dim value As Variant
try_a_gain:
value = InputBox("input value")
flag = True
If value = "" Or value < 2 Then
Resume try_a_gain
End If
For i = 2 To value - 1
If value Mod i = 0 Then
flag = False
Exit For
End If
Next i
If flag = True Then
MsgBox value & " is pri number "
Else
MsgBox value & " is not pri number "
End If
yes = MsgBox("wanna try ? ", vbYesNo)
If yes = vbYes Then
Resume try_a_gain
End If
On Error GoTo error1
error1:
MsgBox "error found"
yes = MsgBox("wanna try ? ", vbYesNo)
If yes = vbYes Then
Resume try_a_gain
End If
End Sub
the error:
Could you please help look on this ? All assist will be appriciated :)