Find and Delete Macro


Posted by Jason A on January 09, 2002 10:56 PM

I need a macro that finds a cell within a range and deletes it.
The deleted value is selected from a combobox, the macro looks within a named range (as per the combobox) and deletes the specified cell only.
My macro doesn't seem to work, can anyone help?

Thanks

Posted by Colo on January 09, 2002 11:30 PM

Hi!

Sub ForExample()
Dim rng As Range
With ActiveSheet
Set rng = .UsedRange.Range("A1")
Do
Set rng = .UsedRange.Find _
(What:=.ComboBox1.Value, After:=rng, LookIn:=xlValues, LookAt:=xlWhole)
If rng Is Nothing Then Exit Do
rng.Clear
Loop
End With
MsgBox "...Done"
End Sub



Posted by Jason A on January 10, 2002 3:35 AM

Colo, Thanks ....but still doesn't work

Thanks, pasted it and changed the range names to mine. But still no luck.
If it helps, the range name of the search range is called "Stafflist".
I tried to avoid loops and use the Find argument is this the best way?

Cheers,