View Single Post
  #7   Report Post  
dfbriles dfbriles is offline
Junior Member
 
Posts: 6
Default

I've tried that code multiple times to no avail. I've made attempts at editing it, but it never does anything. When I run the macro nothing happens. I have attempted using a new code:

Sub Test()
Dim List As Variant
Dim LR As Long
Dim r As Long
List = Array("2514", "2515", "2516", "2972", "2975", "3044", "3045", "10710", "10711", "10713", "10714", "10715", "10716", "10723", "10724", "10725", "10726", "11166", "11171", "11172", "11178", "11301", "11302", "11307", "11313", "11314", "11322", "11323", "11327", "11328", "111360", "11498", "11701", "11702", "11703", "11704", "11705", "11706", "11707", "11708", "12153", "12158", "12164", "12165", "12167", "12168", "12173")
LR = Range("A" & Rows.Count).End(xlUp).Row
For r = LR To 1 Step -1
If IsError(Application.Match(Range("A" & r).Value, List, False)) Then
Rows(r).Delete
End If
Next r
End Sub

But this deletes everything on the worksheet. I just simply cannot understand why I cannot get this to work. I've also had several more experienced excel users help me in person. If anyone has any ideas, please let me know.




Quote:
Originally Posted by GS[_2_] View Post
I entered all 46 of my values into A1 then ran the macro using the
code
you provided. But nothing happened. Should I enter my values in the
the
3rd line of script vCriteria = Split(Range("A1").Value, ",")?


No, leave the list of values in A1. You may need to format A1 as 'Text'
so Excel doesn;t convert your list to scientific notation if the values
are all numeric.

The code reads your values into vCriteria, then starts making a list of
rows that match, starting from the last row of data in colA and going
up to A2. Then it deletes the rows one by one.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion