Take out the Set in the second line of your code,  it should work then.
The reason it only deleted 0 was because inputdelete was blank,  not a
value.  Ditch Set from your code and it will trap the user input from the
input box and delete the row.


[log in to unmask]
21/09/98 02:29

Please respond to [log in to unmask]

To:   [log in to unmask]
cc:    (bcc: Matthew Inns/CFS/ThamesWater)
Subject:  Help with Inputbox

Hi everybody!

I want to create a simple macro that would let a user input a number in an
Inputbox and then for a given selection, the macro would delete the entire
row if it contains the number inputed by the user. However, the macro only
works if the user inputs the number 0 and not for any other number. Can
anybody help me with this? Thanks you very much in advance.

The code is as follows:

'Get the input from user (number)
   On Error Resume Next
   Set InputDelete = Application.InputBox _
      (Prompt:="Specify the text or number to be deleted:", _
      Title:="Text, Number to Delete", _
   On Error GoTo 0

 'For each cell in the selection, the macro will delete the row with the
same number inputed by the user
   For Each Cell In Selection
   If Cell.Value = InputDelete Then
   Selection.Delete Shift:=xlUp
   End If
   Next Cell