View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cr0375 cr0375 is offline
external usenet poster
 
Posts: 4
Default If Statement with Wildcards not Working

I'm trying to make delete all rows that contain the text "UASGN" in column J.
I have tried a few different methods based upon research from this site, but
I'm having an issue with each one. The one I think I'll use is this:

For i = 1 To 672
If Cells(i, "J") = "*UASGN*" Then
Rows(i & ":" & i).Select
Selection.Delete Shift:=xlUp
i = i - 1 ' as we just deleted a row, we should not increase i
End If
Next i

When I use this, it appears to have a problem with the wildcards. If I
remove the wildcards and replace with a finite character(s), it works.

Thanks.