View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default How put Array in VBA

You have to be careful when using the Filter function... it will register
true for partial matches. For example, if c.Value in your example contained
just the letter "X" or "Y" (or any other substring of one of the Array
elements), then it will return an upper bound not equal to -1.

--
Rick (MVP - Excel)


"JP" wrote in message
...
Sub del()
For Each c In Sheets("Data").Column("A")
If UBound(Filter(Array("XX", "YY", "SS", "ZZ"), c.Value)) = -1 Then
c.EntireRow.Delete
End If
Next
End Sub



On Nov 12, 10:33 am, K wrote:
Hi all, how can I make array work in below macro

Sub del()
For Each c In Sheets("Data").Column("A")
If c.Value < Array("XX", "YY", "SS", "ZZ") Then
c.EntireRow.Delete
End If
Next
End Sub

please can any friend can help