InputBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
in VB , when I Cancel or close an InputBox instead of entering data in
it,an error menu showing error 13 appears.how can I avoid the menu?????there
is a commandbox on my worksheet that by pressing that an inputbox pops up,now
when I close the inputbox without entering the data, the error comes up.but I
need just close the inputbox and returning to the worksheet.
thanx
 
thanx.I have a commandbutton in my worksheet by which an inputbox comes
up.here is the code:
Private Sub CommandButton4_Click()
Dim ROWNO As Integer
ROWNO = InputBox("Please Enter Row No. To Change To Regular Part No.:",
"Regular Parts")

Cells(ROWNO + 12, 2) = Application.WorksheetFunction.Substitute(Cells(ROWNO
+ 12, 2), "bb", "")
End Sub
but I don't need the error 13 menu to pop up.any way??
 
thanx.I have a commandbutton in my worksheet by which an inputbox comes
up.here is the code:
Private Sub CommandButton4_Click()
Dim ROWNO As Integer
ROWNO = InputBox("Please Enter Row No. To Change To Regular Part No.:",
"Regular Parts")

Cells(ROWNO + 12, 2) = Application.WorksheetFunction.Substitute(Cells(ROWNO
+ 12, 2), "bb", "")
End Sub
but I don't need the error 13 menu to pop up.any way??

This is how I would handle it. There are other ways of course.
Private Sub CommandButton4_Click()
Dim ROWNO As String
start:
ROWNO = InputBox("Please Enter Row No. " & _
"To Change To Regular Part No.:", _
"Regular Price")
If ROWNO = "" Then
Exit Sub
ElseIf Not IsNumeric(ROWNO) Then
MsgBox "Must be a number"
GoTo start
Else
Cells(ROWNO + 12, 2) = _
Replace(Cells(ROWNO + 12, 2), "bb", "")
End If
End Sub
 
hi,
it doesn't exit sub when ROWNO=""?!

JW said:
This is how I would handle it. There are other ways of course.
Private Sub CommandButton4_Click()
Dim ROWNO As String
start:
ROWNO = InputBox("Please Enter Row No. " & _
"To Change To Regular Part No.:", _
"Regular Price")
If ROWNO = "" Then
Exit Sub
ElseIf Not IsNumeric(ROWNO) Then
MsgBox "Must be a number"
GoTo start
Else
Cells(ROWNO + 12, 2) = _
Replace(Cells(ROWNO + 12, 2), "bb", "")
End If
End Sub
 
Back
Top