ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   InputBox (https://www.excelbanter.com/excel-discussion-misc-queries/159971-inputbox.html)

peyman

InputBox
 
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

FSt1

InputBox
 
hi,
The button your are clicking is calling the inputbox. whoever wrote the code
full well expected someone to enter something in the inputbox. by clicking
cancel, this puts a null string in the variable. the code then trys to do
something with the null string and error 13(type mismatch) occurs. No way
around this.
Are you trying to run a macro by clicking the button? if not, quit clicking
the button. if you are then enter the appropriate input. If you feel that the
input box is not suppose to pop up, then you need to re-write the code.

Regards
FSt1

"peyman" wrote:

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


peyman

InputBox
 
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(ROW NO
+ 12, 2), "bb", "")
End Sub
but I don't need the error 13 menu to pop up.any way??
"FSt1" wrote:

hi,
The button your are clicking is calling the inputbox. whoever wrote the code
full well expected someone to enter something in the inputbox. by clicking
cancel, this puts a null string in the variable. the code then trys to do
something with the null string and error 13(type mismatch) occurs. No way
around this.
Are you trying to run a macro by clicking the button? if not, quit clicking
the button. if you are then enter the appropriate input. If you feel that the
input box is not suppose to pop up, then you need to re-write the code.

Regards
FSt1

"peyman" wrote:

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


JW[_2_]

InputBox
 
On Sep 27, 7:23 pm, peyman wrote:
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(ROW NO
+ 12, 2), "bb", "")
End Sub
but I don't need the error 13 menu to pop up.any way??

"FSt1" wrote:
hi,
The button your are clicking is calling the inputbox. whoever wrote the code
full well expected someone to enter something in the inputbox. by clicking
cancel, this puts a null string in the variable. the code then trys to do
something with the null string and error 13(type mismatch) occurs. No way
around this.
Are you trying to run a macro by clicking the button? if not, quit clicking
the button. if you are then enter the appropriate input. If you feel that the
input box is not suppose to pop up, then you need to re-write the code.


Regards
FSt1


"peyman" wrote:


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


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


peyman

InputBox
 
hi,
it doesn't exit sub when ROWNO=""?!

"JW" wrote:

On Sep 27, 7:23 pm, peyman wrote:
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(ROW NO
+ 12, 2), "bb", "")
End Sub
but I don't need the error 13 menu to pop up.any way??

"FSt1" wrote:
hi,
The button your are clicking is calling the inputbox. whoever wrote the code
full well expected someone to enter something in the inputbox. by clicking
cancel, this puts a null string in the variable. the code then trys to do
something with the null string and error 13(type mismatch) occurs. No way
around this.
Are you trying to run a macro by clicking the button? if not, quit clicking
the button. if you are then enter the appropriate input. If you feel that the
input box is not suppose to pop up, then you need to re-write the code.


Regards
FSt1


"peyman" wrote:


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


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




All times are GMT +1. The time now is 09:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com