How to restart a code upon vbno

F

FARAZ QURESHI

I have the following piece of code and want to restart the procedure if the
user inserts nothing OR zero in the first inputbox and then clicks "No" on
the proceeding MsgBox.

Please highlight, what is wrong with the code?

Public Sub CNV()
Dim check12 As Double
check12 = Application.INPUTBOX (prompt:="Input Dollar Conversion Rate",
Type:=1)
If check12 Is Nothing Then
fb = MsgBox("You have not inserted anything. You want to continue?",
vbYesNo)
If fb = vbYes Then
ActiveCell = "=A1*" & check
Else: GoTo check12
End If
End If
End Sub
 
C

CurlyDave

Try this
Sub CNV()
Dim c As Integer
On Error GoTo ExitProc
c = InputBox("Enter Value")
ActiveCell = "=A1*" & c
Exit Sub
ExitProc:
fb = MsgBox("You have not inserted anything. You want to
continue?", vbYesNo)
If fb = vbYes Then CNV
If fb = vbNo Then Exit Sub

End Sub
 
F

FARAZ QURESHI

XCLENT!
By the way upon entering Zero the code continues. How 2 insert an OR
condition to check whether the No value or Zero was inserted?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top