View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
bengalengel bengalengel is offline
external usenet poster
 
Posts: 6
Default macro to filter rows containing user defined data

The following is along the lines of what I am thinking, minus the
putting of the rows into a new sheet deal (which is not absolutely
essential for me).

Sub DelUnmatchedRows()
Dim rRange As Range
Dim i&
Rng = Selection.Rows.Count

On Error Resume Next
Set rRange = Application.InputBox(Prompt:= _
"Please select a range with your Mouse.", _
Title:="SPECIFY RANGE", Type:=8)


If (rRange Is Nothing) = False Then


ActiveCell.Offset(0, 0).Select
Application.ScreenUpdating = False
For i = 1 To Rng
For Each rngCell In rRange.Cells
If (ActiveCell.Value Eqv rngCell.Value) = False Then
Selection.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Next i
Application.ScreenUpdating = True
End Sub

I am getting the invalid next control variable error and the editor is
highlighting i. Thanks again
Brett