View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ikaabod[_25_] Ikaabod[_25_] is offline
external usenet poster
 
Posts: 1
Default Conditional Delete in Excel using Macro


Would something like this work for you?

Private Sub Workbook_Open()
Dim mySheet As String
Dim myErrorIND As String
Dim myCountry As String
Dim myType As String

mySheet = "Sheet1"
myErrorIND = "Error"
myCountry = "CA"
myType = "Software"

Worksheets(mySheet).Activate
Range("A1").Select
Do
If ActiveCell = myErrorIND And ActiveCell.Offset(0, 1) = myCountry And
ActiveCell.Offset(0, 2) = myType Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until IsEmpty(ActiveCell)
Range("A1").Select
End Sub


--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=536595