View Full Version : search and delete

09-23-2008, 05:40 PM
Hi.. ok i need a code that will take the value in A1, search through C2:W2 and match it. once it is matched i need to delete everything in that colmn from 3:100

example. A1= bob. search from C2:W2 for bob. match is found in H2, then delete H2:H100.

any idea??

09-23-2008, 06:41 PM
try this:

Sub Delete_Rows_Meeting_Criteria()
For x = 3 To 23
If Cells(2, x).Value = Cells(1, 1).Value Then
Range(Cells(3, x), Cells(100, x)).ClearContents
End If
End Sub