Hi,
I am trying to write a macro in Excel 2003 that will sort some data and delete the unwanted rows. Basically, starting on line 3, in columns C to L, if the charater strings "N" or "NI" DO NOT appear, I want to delete the row. The number of total rows will vary. I am getting an Else without If error. Here is my code. By the way, I am new to programming so the help is much appreciated.
Oh, and the Macro should exit on the first blank row.
Sub FilterPositives()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Report")
iRow = ws.Cells(Rows.Count, 10).End(xlUp).Offset(2, 3).Row
If ws.Cells(iRow, 1).Value = "" Then MsgBox "Report Complete"
ElseIf ws.Cells(iRow, 2).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 2).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 3).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 4).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 5).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 6).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 7).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 8).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 9).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
ElseIf ws.Cells(iRow, 10).Value = "N" Or ws.Cells(iRow, 1).Value = "NI" Then
Next iRow
Else: ActiveCell.Row.Select
Selection.Delete
Next iRow
End If