LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default Automatic delete row in Excel 2003

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
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 automatic headers/footers in dropdown lists in Excel 2003 MJ Excel Discussion (Misc queries) 0 November 8th 07 05:26 PM
Excel 2003 - Comments box - automatic resizing Trish Excel Discussion (Misc queries) 1 August 18th 07 05:36 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
how do you turn off automatic hyperlink in excel 2003 DaveBerk Excel Discussion (Misc queries) 1 January 19th 05 05:17 PM
Automatic links in Excel 2003 Jim Bud Excel Discussion (Misc queries) 4 January 13th 05 03:57 PM


All times are GMT +1. The time now is 11:33 PM.

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

About Us

"It's about Microsoft Excel"