View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default how to delete specific values in cells

Consider:

Sub col_killer()
Dim r As Range, cel As Range
Dim s As String
s = "
Set r = Nothing

For Each cel In ActiveSheet.UsedRange
If cel.Value = s Then
If r Is Nothing Then
Set r = cel
Else
Set r = Union(r, cel)
End If
End If
Next

If r Is Nothing Then
Else
r.EntireColumn.Delete
End If
End Sub
--
Gary's Student - gsnu2007k


" wrote:

Hi,
I have a problem with excel 2007. I want to delete some columns which
include some words (like as @xxx.com.au). How to delete those colums
with macro?
Pls let me know. Thanks.