fari1
Active Member
- Joined
- May 29, 2011
- Messages
- 362
hi, my below code is deleting the rows that contain the text defined in the code, while i want to delete the rows other than below text.
plz help
plz help
Code:
Sub filingsdelete()
Dim wsInput As Worksheet
Dim wsInputLRw As Long, i As Long
Dim RngSource As Range
Application.ScreenUpdating = False
Set wsInput = Sheets("filings")
wsInputLRw = wsInput.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To wsInputLRw
Select Case UCase(wsInput.Range("A" & i).Value)
Case "10-K", "10-Q", "10-K/A", "10-Q/A"
If RngSource Is Nothing Then
Set RngSource = wsInput.Range("A" & i)
Else
Set RngSource = Union(RngSource, wsInput.Range("A" & i))
End If
End Select
Next i
If Not RngSource Is Nothing Then _
RngSource.EntireRow.Delete
End Sub