I hate the way this forum loses indentation. Well, let's take a look at this. va=R.Value creates a two-dimensional array and places all the UsedRange values into it, right? Then you start up a three-level loop and...
Wait, maybe I see the problem. Sheet2 contains, you said, one column and multiple rows, right? The statement "mynums = Sheets("sheet2").Range("a2:a226").Value" creates a two-dimensional array, but later on you're referring to "mynums(i)"; don't you have to refer to "mynums(i,1)"?
Also I think you're going to have to move the "End If" statement up one line, to be inside the For...Next group.
Oh, by the way, another time this question should probably be posted to the Excel Programming area, rather than this one.
|