Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Marc
This macro will do what you need. Just change IdCol, StatusCol and StartRow as required. Sub DeleteClosedCases() Dim IdCol As String Dim StatusCol As String Dim StartRow As Integer Dim StatusRange As Range Dim tRow As Double Dim FoundID Dim ID As Double IdCol = "A" StatusCol = "B" StartRow = 2 'Headings in Row 1 Set StatusRange = Range(Cells(StartRow, StatusCol), _ Cells(StartRow, StatusCol).End(xlDown)) For Each r In StatusRange If r.Value = "Closed" Then tRow = r.Row ID = Cells(tRow, IdCol).Value Set FoundID = Columns(IdCol).Find(What:=ID, After:=ActiveCell, _ LookIn:=xlValues, LookAt:=xlWhole) Do Until FoundID Is Nothing FoundID.EntireRow.Delete Set FoundID = Columns(IdCol).Find(What:=ID, After:=ActiveCell, _ LookIn:=xlValues, LookAt:=xlWhole) Loop End If Next End Sub Regards, Per "Marc Robinson" skrev i meddelelsen ... Hello, I have a workbook full of data (Incident data reported to my helpdesk) that is sorted into columns as follows: Incident ID Modified By Contact Name Last Modified Current Status Title Duplicate data is produced in the workbook if the incident data had a change of status in its lifecycle (Eg. from Open to Resolved to Closed). I want to know how I can automatically delete rows of data if one particular row has the word, 'Closed' against it? Eg. If Row 1 had an Incident number of 1 and Row 2 had an incident number of 1 and the corresponding Status had a value of Open in Row 1 and a value of Closed in Row 2, how can i automcatically delete both rows? Please contact me if more information is required. Thanks, Marc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete automatic headers/footers in dropdown lists in Excel 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 - Comments box - automatic resizing | Excel Discussion (Misc queries) | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) | |||
how do you turn off automatic hyperlink in excel 2003 | Excel Discussion (Misc queries) | |||
Automatic links in Excel 2003 | Excel Discussion (Misc queries) |