View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Using alphanumeric and numeric criteria in same code

It works for numbers like 123 and 456 (I just tried it), so you will need to
show us the Const statement you are using (so we can see how you are
specifying your numbers) and tell us how the number is formatted (if at all)
in the cells of Column E.

--
Rick (MVP - Excel)


"Peruanos72" wrote in message
...
I was given the following code and it works but I need to also add criteria
that is numeric only. When I add numeric only criteria it does not work.
Thoughts??

Sub DeleteRows()
Dim kpxRow As Long
Dim kpxTemp As Long
Const Criteria As String = "Y08,Y09"
With ActiveSheet
kpxRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For kpxTemp = kpxRow To 1 Step -1
If InStr("," & Criteria & ",", "," & Left(.Cells(kpxTemp, _
"E").Value, 3) & ",") Then .Rows(kpxTemp).Delete
Next
End With
End Sub