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 |
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 |
All times are GMT +1. The time now is 09:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com