View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers,microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Need Help Editing Cells

will this work for you?

Sub test2()
Dim cell As Range
Dim lastrow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "d").End(xlUp).Row

For Each cell In ws.Range("d1:d" & lastrow)
If InStr(1, cell.Value, "Honda") 0 Then
cell.Value = "Honda"
Else
cell.Value = ""
End If
Next

End Sub

--


Gary


"mike" wrote in message
oups.com...
I am using W XP and Excel 2003. I have an XLS file that was created
from a CSV file. Column D of the Xls file containd a great deal of data
that is still comma seperated. For example a row may have Ford, Chevy,
Dodge... Another row in the same column may have Dodge, Honda,
Toyota...

What I want to do is delete the contents of any cell in Column D that
does not contain Honda. Any cell that does contain Honda should have
any other data deleted except for Honda.

Thanks for any and all help.