View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro to find row and delete it

Dim rng as Range
Dim sItem as String
Dim res as Variant
do until len(Trim(sItem)) 0
sItem = InputBox("Input Serial Number:")
Loop
With Worksheets("Sheet2")
set rng = .Range( _
.Cells(2,1),.Cells(rows.count,1).end(xlup))
End With
res = Application.Match(sItem, rng, 0)
if not iserror(res) then
rng(res).EntireRow.Delete
End if


if the serial number and values in Column A of sheet2 will be numeric
change

res = Application.Match(clng(sItem), rng, 0 )

--
Regards,
Tom Ogilvy


Piet Lauwen wrote in message
...
Hi group,

I am working on this macro now for some days now but with no succes....

From Worksheet3 I ask input for an "Item" (f.i. serialnumber) with an

input
box.
The "item" has to be found in the first collumn of a database in
Worksheet2.
When the "Item" is found the complete row where it is foud should be
deleted.

What approach should I take?

Thanks in Adavance,

Piet Lauwen

e-Mail: