Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joe,
I have been happier using the InputBox function instead of the InputBox method. It returns a string and if cancel is clicked it returns a zero length string .. As long as you want only want to determine one row then see how this work... '------------------------ Sub TestIt2() Dim MyNum As Variant MyNum = "1" DoAgain: MyNum = InputBox(vbCr & "Enter row number", "Real Good Program", MyNum) If Len(MyNum) = 0 Then Rows(1).Select Else MyNum = Left(Abs(Val(MyNum)), 6) If MyNum < 1 Or MyNum Rows.Count Then MyNum = "Invalid Entry - Try Again" GoTo DoAgain Else Rows(MyNum).Select End If End If End Sub '------------------------------ Regards, Jim Cone San Francisco, Ca *********************** "Joe 90" wrote in message ... Hi, I have an input box that asks the user to select a row (by picking a cell). The dialog box provides for an Ok button and a Cancel button. If the user clicks the Cancel button I get an error in VBA. I want to create a rounded app so everything works and I have tried all ways to get this to go away but nothing I can do will make the inputbox accept a "Range object" as the default, and therefore allow the Cancel. All I get is a "Run time error 13, type mismatch" Here's the code: +++++++++++++++++++++++++++++++++++++++++++ Sub PickRow ( ) dim mynum set mynum = Application.InputBox ( "Select Row" , type: = 8 ) End Sub +++++++++++++++++++++++++++++++++++++++++++ I have tried putting a variable for a range, a range address, and a range reference in as default e.g. set mynum = Application.InputBox ( "Select Row" , , "$A$1" ,type: = 8 ) What am I doing wrong, or is this a vagary of the object model, that because I am choosing to seek a range object type, the Cancel button will always produce an error?? Hoping you can help.................................. Joe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
inputbox type 64 (array) | Excel Discussion (Misc queries) | |||
Exit Code Upon Cancel On Type 8 Input Box | Excel Discussion (Misc queries) | |||
InputBox / VBA question ok = print, cancel = exit | Excel Worksheet Functions | |||
Detecting Cancel in an InputBox Method | Excel Discussion (Misc queries) | |||
how do i cancel the type blocking in the cell? | New Users to Excel |