Thread: delete based on
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default delete based on

Try some VBA code like the following:


Dim CCRng As Range
Dim CTRng As Range
Dim CSRng As Range

Set CCRng = Range("A:A").Find(what:="CC", lookat:=xlWhole,
LookIn:=xlValues)
If Not CCRng Is Nothing Then
Set CTRng = Range("A:A").Find(what:="CT", lookat:=xlWhole,
LookIn:=xlValues)
If Not CTRng Is Nothing Then
CTRng.EntireRow.Delete
End If
Set CSRng = Range("A:A").Find(what:="CS", lookat:=xlWhole,
LookIn:=xlValues)
If Not CSRng Is Nothing Then
CSRng.EntireRow.Delete
End If
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"flow23" wrote in message
...
I have a list
where fields organisation and position
In the position the fields are either CC (chairman), CT
(treasures) and CS
(secretary)

what if want is a macro to look up the list. and if the
chairman field is
there, then delete row CT aND CS
and if CC is not there then keep either CT and if CT is not
there then keep
CS