非常感谢samsoncsr指点,本来是用matlab软件处理的,多少都觉得不尽如人意,想直接用excel处理,这样也比较简单,呵呵,我再尝试一下,再次谢谢! 推荐office精英版主iq66的方法: Sub yy() Dim rng, data$, i%, j%, m% Sheet2.Cells.Clear Sheet3.Cells.Clear rng = Range("a2:k" & [a65536].End(xlUp).Row) Sheet2.[a1:k1] = Application.Index(rng, 1) Sheet3.[a1:k1] = Application.Index(rng, 1) data = ",2,3,7,10," For i = 2 To UBound(rng) For j = 2 To 11 If InStr(data, "," & rng(i, j) & ",") > 0 Then m = m + 1 If m = 2 Then If Sheet2.[a:a].Find(rng(i, 1)) Is Nothing Then Sheet2.[a65536].End(xlUp)(2, 1).Resize(1, 11) = Application.Index(rng, i) End If End If If m >= 3 Then If Sheet3.[a:a].Find(rng(i, 1)) Is Nothing Then Sheet3.[a65536].End(xlUp)(2, 1).Resize(1, 11) = Application.Index(rng, i): Exit For End If End If Next j m = 0 Next i End Sub
[此贴子已经被作者于2008-5-14 19:38:04编辑过] |