View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Miree Miree is offline
external usenet poster
 
Posts: 90
Default Search up from last row

I need to modify my code to search from the last row, at the moment it only
goes from the last row there is data in for my specific column(DT), can I
make it start from the last row where there is data from column A but only
searching the column i need(DT)

Dim rng As Range
Dim i As Long

Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp))

With rng
For i = .Rows.Count To 1 Step -1
If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then
.Cells(i).EntireRow.Delete
End If
Next i
End With

Thank you in advance