Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default how to delete specific values in cells

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.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete cells containing specific data? Mobility Guy Excel Discussion (Misc queries) 1 March 22nd 07 08:29 PM
Count cells with specific values in the cells next to them? Christopher Excel Worksheet Functions 2 September 8th 05 05:49 PM
how to delete contents of cells having specific data steve Excel Discussion (Misc queries) 2 July 20th 05 10:42 PM
Macro do delete values in cells Esrei Excel Discussion (Misc queries) 1 April 14th 05 04:01 PM
Locate and delete specific cells David Smith Excel Discussion (Misc queries) 1 January 19th 05 04:45 PM


All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"