View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ashish Mathur[_2_] Ashish Mathur[_2_] is offline
external usenet poster
 
Posts: 1,766
Default If Statement with Wildcards not Working

Hi,

You may also try this. Select the column and press Ctrl+F. In the find
what box, type UASGN and then click on find All. Now press Ctrl+A to
highlight all the cell which have UASGN. You may now delete them

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"cr0375" wrote in message
...
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.