LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Input Box - Type mismatch

Hello all, I'm not sure what i am doing wrong and need your help please.
I wrote a code that asks the user for the row number they wish to delete.
But i keep getting the following error message:
Run-Time error '13' - Type mismatch.

Here is the code i wrote:

Sub Del_Row()

' Ask user for the row number
Dim RowToDelete As Long
RowToDelete = InputBox( _
Prompt:="Please enter the row number you wish to delete, eg: 23", _
Title:="Which Row Do You Wish to Delete?")

' exit sub if user presses 'cancel'
If RowToDelete = "" Then
Exit Sub
End If

if RowToDelete 20 then
Rows(RowToDelete).delete
Else
MsgBox "Sorry! You cannot delete This row."
End If

End Sub

When i run the macro, i get the inputbox asking me for the number but when i
press cancel or enter a number i keep getting the above error message. Any
ideas?
I'm using Excel 2003
Thanks in advance
Tendresse
 
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
error 13 type mismatch input box cluckers Excel Discussion (Misc queries) 1 October 28th 09 07:01 PM
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
input box date type mismatch Matilda Excel Programming 4 November 26th 05 02:40 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM


All times are GMT +1. The time now is 11:23 AM.

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

About Us

"It's about Microsoft Excel"