#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 638
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox GeorgeJ Excel Discussion (Misc queries) 5 July 12th 07 01:20 AM
inputbox brownti via OfficeKB.com Excel Discussion (Misc queries) 2 February 9th 07 02:37 PM
msgbox / inputbox etc samenvoegen van sheets Excel Worksheet Functions 2 March 15th 06 04:28 PM
Inputbox with VBA Jeff Excel Discussion (Misc queries) 3 January 19th 06 05:18 PM
Inputbox with Listbox Jeff Excel Discussion (Misc queries) 3 December 22nd 04 05:54 PM


All times are GMT +1. The time now is 06:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"