Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete based on
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create formula that will pull a value based on text in diff cell? | Excel Discussion (Misc queries) | |||
Delete rows based on multiple criterias | Excel Discussion (Misc queries) | |||
Delete record(s) in other cells based on value of one cell. | Excel Discussion (Misc queries) | |||
How to delete blank rows | Excel Discussion (Misc queries) | |||
Stubborn toolbars in Excel | Excel Discussion (Misc queries) |